From e3347a5c81590368f590783d9afe979dada9f555 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 25 Jun 2023 18:38:37 +0200 Subject: [PATCH] refactor: cleanup queued tasks computation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/pools/abstract-pool.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 }, -- 2.34.1