From: Jérôme Benoit Date: Thu, 15 Aug 2024 12:39:44 +0000 (+0200) Subject: refactor: define a variable only when needed X-Git-Tag: v4.2.3~7 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=4f28c7ae4e0c53cb328c4e5bdfe246f02fe1baf2;p=poolifier.git refactor: define a variable only when needed Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index a1b6b02e..7aae2c89 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -1961,7 +1961,6 @@ export abstract class AbstractPool< `Worker node with key '${workerNodeKey.toString()}' not found in pool` ) } - const workerNodeTasksUsage = this.workerNodes[workerNodeKey].usage.tasks if ( !workerNodeInfo.continuousStealing && (this.cannotStealTask() || @@ -1974,6 +1973,7 @@ export abstract class AbstractPool< ) { return } + const workerNodeTasksUsage = this.workerNodes[workerNodeKey].usage.tasks if ( workerNodeInfo.continuousStealing && (workerNodeTasksUsage.executing > 0 ||