mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
add debug time measurements
This commit is contained in:
parent
375706336f
commit
4a33ae5856
1 changed files with 9 additions and 1 deletions
10
meshagent.js
10
meshagent.js
|
@ -998,19 +998,24 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const agentCreateTime = Date.now();
|
||||||
|
console.log(('' + 0).padStart(8), 'CREATE MeshArgent');
|
||||||
const WarmupPromisesMixin = {
|
const WarmupPromisesMixin = {
|
||||||
resolvedCount: 0,
|
resolvedCount: 0,
|
||||||
create: function create(key) {
|
create: function create(key) {
|
||||||
|
console.log(('' + (Date.now() - agentCreateTime)).padStart(8), 'CREATE Promise', key);
|
||||||
let resolvePromise, promise = new Promise((resolve) => { resolvePromise = resolve; });
|
let resolvePromise, promise = new Promise((resolve) => { resolvePromise = resolve; });
|
||||||
this[key] = resolvePromise;
|
this[key] = resolvePromise;
|
||||||
this.push(promise);
|
this.push(promise);
|
||||||
},
|
},
|
||||||
resolve: function resolve(key) {
|
resolve: function resolve(key) {
|
||||||
if (this.hasOwnProperty(key)) {
|
if (this.hasOwnProperty(key)) {
|
||||||
|
console.log(('' + (Date.now() - agentCreateTime)).padStart(8), 'RESOLVE Promise', key);
|
||||||
this[key]();
|
this[key]();
|
||||||
delete this[key];
|
delete this[key];
|
||||||
if (++this.resolvedCount == this.length) {
|
if (++this.resolvedCount == this.length) {
|
||||||
this.length = 0;
|
this.length = 0;
|
||||||
|
console.log(('' + (Date.now() - agentCreateTime)).padStart(8), 'ALL PROMISES RESOLVED');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1147,7 +1152,10 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||||
if (parent.parent.pluginHandler != null) {
|
if (parent.parent.pluginHandler != null) {
|
||||||
Promise.all(warmupDbPromises)
|
Promise.all(warmupDbPromises)
|
||||||
.then(() => Promise.all(warmupActionPromises))
|
.then(() => Promise.all(warmupActionPromises))
|
||||||
.then(() => parent.parent.pluginHandler.callHook('hook_agentCoreIsStable', obj, parent));
|
.then(() => {
|
||||||
|
console.log(('' + (Date.now() - agentCreateTime)).padStart(8), 'AGENT CORE IS ATABLE');
|
||||||
|
parent.parent.pluginHandler.callHook('hook_agentCoreIsStable', obj, parent)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue