From: Jérôme Benoit Date: Mon, 14 Aug 2023 20:25:51 +0000 (+0200) Subject: fix: emit error event if a dynamic worker destroy fails X-Git-Tag: v2.6.26~27 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=5270d253891b2f6e3a849ddd2f5a305e312cdab5;p=poolifier.git fix: emit error event if a dynamic worker destroy fails Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index f76ad2f5..2a52d548 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -958,7 +958,9 @@ export abstract class AbstractPool< workerUsage.tasks.executing === 0 && this.tasksQueueSize(localWorkerNodeKey) === 0))) ) { - this.destroyWorkerNode(localWorkerNodeKey).catch(EMPTY_FUNCTION) + this.destroyWorkerNode(localWorkerNodeKey).catch((error) => { + this.emitter?.emit(PoolEvents.error, error) + }) } }) const workerInfo = this.getWorkerInfo(workerNodeKey)