From: Jérôme Benoit Date: Sun, 20 Aug 2023 11:19:17 +0000 (+0200) Subject: fix: fix task function queue size computation X-Git-Tag: v2.6.31~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=e5ece61ddfc86e400b9b7a6bee1bc91c0c53f3ad;p=poolifier.git fix: fix task function queue size computation Signed-off-by: Jérôme Benoit --- 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 },