From e5ece61ddfc86e400b9b7a6bee1bc91c0c53f3ad Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 20 Aug 2023 13:19:17 +0200 Subject: [PATCH] fix: fix task function queue size computation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/pools/worker-node.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pools/worker-node.ts b/src/pools/worker-node.ts index dbbfbe67..82e27688 100644 --- a/src/pools/worker-node.ts +++ b/src/pools/worker-node.ts @@ -190,25 +190,25 @@ implements IWorkerNode { } private initTaskFunctionWorkerUsage (name: string): WorkerUsage { - const getTaskQueueSize = (): number => { - let taskQueueSize = 0 + const getTaskFunctionQueueSize = (): number => { + let taskFunctionQueueSize = 0 for (const task of this.tasksQueue) { if ( - (name === DEFAULT_TASK_NAME && - task.name === (this.info.taskFunctions as string[])[1]) || - task.name === name + (task.name === DEFAULT_TASK_NAME && + name === (this.info.taskFunctions as string[])[1]) || + (task.name !== DEFAULT_TASK_NAME && name === task.name) ) { - ++taskQueueSize + ++taskFunctionQueueSize } } - return taskQueueSize + return taskFunctionQueueSize } return { tasks: { executed: 0, executing: 0, get queued (): number { - return getTaskQueueSize() + return getTaskFunctionQueueSize() }, failed: 0 }, -- 2.34.1