From: Jérôme Benoit Date: Sun, 3 Sep 2023 20:14:56 +0000 (+0200) Subject: refactor: remove unneeded condition in task(s) redistribution X-Git-Tag: v2.6.42~13 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=3f690f25c5137aa97b58231b37ac0a5b274b08c7;p=poolifier.git refactor: remove unneeded condition in task(s) redistribution Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 7933b544..9dcc6edd 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -1211,17 +1211,15 @@ export abstract class AbstractPool< }, 0 ) - if (destinationWorkerNodeKey != null) { - const destinationWorkerNode = this.workerNodes[destinationWorkerNodeKey] - const task = { - ...(this.dequeueTask(workerNodeKey) as Task), - workerId: destinationWorkerNode.info.id as number - } - if (this.shallExecuteTask(destinationWorkerNodeKey)) { - this.executeTask(destinationWorkerNodeKey, task) - } else { - this.enqueueTask(destinationWorkerNodeKey, task) - } + const destinationWorkerNode = this.workerNodes[destinationWorkerNodeKey] + const task = { + ...(this.dequeueTask(workerNodeKey) as Task), + workerId: destinationWorkerNode.info.id as number + } + if (this.shallExecuteTask(destinationWorkerNodeKey)) { + this.executeTask(destinationWorkerNodeKey, task) + } else { + this.enqueueTask(destinationWorkerNodeKey, task) } } }