From: Jérôme Benoit Date: Thu, 31 Aug 2023 13:06:11 +0000 (+0200) Subject: refactor: code cleanup X-Git-Tag: v2.6.40~16 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f778c3551ba2ea67542a4552ce353a4a0b41efb6;p=poolifier.git refactor: code cleanup Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 493c5ccc..7075bc6c 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -1284,7 +1284,8 @@ export abstract class AbstractPool< } private tasksStealingOnBackPressure (workerId: number): void { - if ((this.opts.tasksQueueOptions?.size as number) <= 1) { + const sizeOffset = 1 + if ((this.opts.tasksQueueOptions?.size as number) <= sizeOffset) { return } const sourceWorkerNode = @@ -1301,7 +1302,7 @@ export abstract class AbstractPool< workerNode.info.ready && workerNode.info.id !== workerId && workerNode.usage.tasks.queued < - (this.opts.tasksQueueOptions?.size as number) - 1 + (this.opts.tasksQueueOptions?.size as number) - sizeOffset ) { const task = { ...(sourceWorkerNode.popTask() as Task),