From: Jérôme Benoit Date: Sun, 25 Jun 2023 16:38:37 +0000 (+0200) Subject: refactor: cleanup queued tasks computation X-Git-Tag: v2.6.4~29 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=e3347a5c81590368f590783d9afe979dada9f555;p=poolifier.git refactor: cleanup queued tasks computation Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 07907be9..413a1fc0 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -911,15 +911,15 @@ export abstract class AbstractPool< } private getWorkerUsage (workerNodeKey?: number): WorkerUsage { - const getQueueSize = (workerNodeKey: number): number => { - return this.tasksQueueSize(workerNodeKey) + const getTasksQueueSize = (workerNodeKey?: number): number => { + return workerNodeKey != null ? this.tasksQueueSize(workerNodeKey) : 0 } return { tasks: { executed: 0, executing: 0, get queued (): number { - return workerNodeKey == null ? 0 : getQueueSize(workerNodeKey) + return getTasksQueueSize(workerNodeKey) }, failed: 0 },