From: Jérôme Benoit Date: Fri, 23 Jun 2023 19:31:35 +0000 (+0200) Subject: fix: get wait time statistics X-Git-Tag: v2.6.4~40 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b9907d18a228d06e9f2c2e342f8bb16bb4cd3d8e;p=poolifier.git fix: get wait time statistics Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts index b9f6e721..476c58bc 100644 --- a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts @@ -176,8 +176,8 @@ export abstract class AbstractWorkerChoiceStrategy< */ protected getWorkerTaskWaitTime (workerNodeKey: number): number { return this.taskStatisticsRequirements.waitTime.median - ? this.pool.workerNodes[workerNodeKey].workerUsage.runTime.median - : this.pool.workerNodes[workerNodeKey].workerUsage.runTime.average + ? this.pool.workerNodes[workerNodeKey].workerUsage.waitTime.median + : this.pool.workerNodes[workerNodeKey].workerUsage.waitTime.average } /** diff --git a/src/worker/abstract-worker.ts b/src/worker/abstract-worker.ts index a84bb069..b0da7b3e 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -160,13 +160,13 @@ export abstract class AbstractWorker< } else if (message.parent != null) { // Main worker reference message received this.mainWorker = message.parent + } else if (message.statistics != null) { + // Statistics message received + this.statistics = message.statistics } else if (message.kill != null) { // Kill message received this.aliveInterval != null && clearInterval(this.aliveInterval) this.emitDestroy() - } else if (message.statistics != null) { - // Statistics message received - this.statistics = message.statistics } }