From: Jérôme Benoit Date: Mon, 10 Apr 2023 03:59:53 +0000 (+0200) Subject: perf: optimize pool shutdown X-Git-Tag: v2.4.6~7 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=875a7c37808f9dd37369348b5b4574881d5f9c32;p=poolifier.git perf: optimize pool shutdown Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 6548eba3..661eb7b6 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -258,8 +258,8 @@ export abstract class AbstractPool< /** @inheritDoc */ public async destroy (): Promise { await Promise.all( - this.workerNodes.map(async workerNode => { - this.flushTasksQueueByWorker(workerNode.worker) + this.workerNodes.map(async (workerNode, workerNodeKey) => { + this.flushTasksQueue(workerNodeKey) await this.destroyWorker(workerNode.worker) }) )