Simplify stats sending.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 6m16s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 6m16s
This commit is contained in:
parent
24cec21465
commit
221f276c4b
@ -211,10 +211,6 @@ async function socket(request, response, client) {
|
|||||||
if (process && process.timeout > 0) {
|
if (process && process.timeout > 0) {
|
||||||
setTimeout(ping, process.timeout);
|
setTimeout(ping, process.timeout);
|
||||||
}
|
}
|
||||||
} else if (message.action == 'enableStats') {
|
|
||||||
if (process) {
|
|
||||||
core.enableStats(process, message.enabled);
|
|
||||||
}
|
|
||||||
} else if (message.action == 'resetPermission') {
|
} else if (message.action == 'resetPermission') {
|
||||||
if (process) {
|
if (process) {
|
||||||
process.resetPermission(message.permission);
|
process.resetPermission(message.permission);
|
||||||
|
@ -1274,7 +1274,6 @@ function _receive_websocket_message(message) {
|
|||||||
document.getElementById('viewPane').style.display = message.edit_only
|
document.getElementById('viewPane').style.display = message.edit_only
|
||||||
? 'none'
|
? 'none'
|
||||||
: 'flex';
|
: 'flex';
|
||||||
send({action: 'enableStats', enabled: true});
|
|
||||||
} else if (message && message.action == 'ping') {
|
} else if (message && message.action == 'ping') {
|
||||||
send({action: 'pong'});
|
send({action: 'pong'});
|
||||||
} else if (message && message.action == 'stats') {
|
} else if (message && message.action == 'stats') {
|
||||||
|
21
core/core.js
21
core/core.js
@ -286,7 +286,6 @@ async function getProcessBlob(blobId, key, options) {
|
|||||||
process.lastActive = Date.now();
|
process.lastActive = Date.now();
|
||||||
process.lastPing = null;
|
process.lastPing = null;
|
||||||
process.timeout = options.timeout;
|
process.timeout = options.timeout;
|
||||||
process.stats = false;
|
|
||||||
process.ready = new Promise(function (resolve, reject) {
|
process.ready = new Promise(function (resolve, reject) {
|
||||||
resolveReady = resolve;
|
resolveReady = resolve;
|
||||||
rejectReady = reject;
|
rejectReady = reject;
|
||||||
@ -778,6 +777,10 @@ async function getProcessBlob(blobId, key, options) {
|
|||||||
}
|
}
|
||||||
await process.task.execute({name: appSourceName, source: appSource});
|
await process.task.execute({name: appSourceName, source: appSource});
|
||||||
resolveReady(process);
|
resolveReady(process);
|
||||||
|
if (!gStatsTimer) {
|
||||||
|
gStatsTimer = true;
|
||||||
|
sendStats();
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (process.app) {
|
if (process.app) {
|
||||||
if (process?.task?.onError) {
|
if (process?.task?.onError) {
|
||||||
@ -1200,7 +1203,7 @@ async function loadSettings() {
|
|||||||
*/
|
*/
|
||||||
function sendStats() {
|
function sendStats() {
|
||||||
let apps = Object.values(gProcesses)
|
let apps = Object.values(gProcesses)
|
||||||
.filter((process) => process.app && process.stats)
|
.filter((process) => process.app)
|
||||||
.map((process) => process.app);
|
.map((process) => process.app);
|
||||||
if (apps.length) {
|
if (apps.length) {
|
||||||
let stats = getStats();
|
let stats = getStats();
|
||||||
@ -1213,19 +1216,6 @@ function sendStats() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* TODOC
|
|
||||||
* @param {*} process
|
|
||||||
* @param {*} enabled
|
|
||||||
*/
|
|
||||||
function enableStats(process, enabled) {
|
|
||||||
process.stats = enabled;
|
|
||||||
if (!gStatsTimer) {
|
|
||||||
gStatsTimer = true;
|
|
||||||
sendStats();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODOC
|
* TODOC
|
||||||
*/
|
*/
|
||||||
@ -1342,7 +1332,6 @@ function storePermission(user, packageOwner, packageName, permission, allow) {
|
|||||||
export {
|
export {
|
||||||
gGlobalSettings as globalSettings,
|
gGlobalSettings as globalSettings,
|
||||||
setGlobalSettings,
|
setGlobalSettings,
|
||||||
enableStats,
|
|
||||||
invoke,
|
invoke,
|
||||||
getSessionProcessBlob,
|
getSessionProcessBlob,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user