From 852ed3e4c74c53cf5072414431016b4cb43576bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 3 Sep 2023 22:05:39 +0200 Subject: [PATCH] refactor: cleanup task redistribution code 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 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 }, -- 2.34.1