From: Jérôme Benoit Date: Sun, 3 Sep 2023 20:05:39 +0000 (+0200) Subject: refactor: cleanup task redistribution code X-Git-Tag: v2.6.42~14 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=852ed3e4c74c53cf5072414431016b4cb43576bc;p=poolifier.git refactor: cleanup task redistribution code Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index aae08395..7933b544 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -1203,11 +1203,9 @@ export abstract class AbstractPool< while (this.tasksQueueSize(workerNodeKey) > 0) { const destinationWorkerNodeKey = this.workerNodes.reduce( (minWorkerNodeKey, workerNode, workerNodeKey, workerNodes) => { - if (!workerNode.info.ready) { - return minWorkerNodeKey - } - return workerNode.usage.tasks.queued < - workerNodes[minWorkerNodeKey].usage.tasks.queued + return workerNode.info.ready && + workerNode.usage.tasks.queued < + workerNodes[minWorkerNodeKey].usage.tasks.queued ? workerNodeKey : minWorkerNodeKey },