From: Jérôme Benoit Date: Thu, 20 Jul 2023 16:10:45 +0000 (+0200) Subject: fix: close communication channel on error X-Git-Tag: v2.6.19~3 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=0dc838e376fd1fea7146350e99e487159e4ba40a;p=poolifier.git fix: close communication channel on error Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 93023794..d55c3101 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -862,6 +862,7 @@ export abstract class AbstractPool< const workerNodeKey = this.getWorkerNodeKey(worker) const workerInfo = this.getWorkerInfo(workerNodeKey) workerInfo.ready = false + this.workerNodes[workerNodeKey].closeChannel() this.emitter?.emit(PoolEvents.error, error) if (this.opts.restartWorkerOnError === true && !this.starting) { if (workerInfo.dynamic) { @@ -877,7 +878,6 @@ export abstract class AbstractPool< worker.on('online', this.opts.onlineHandler ?? EMPTY_FUNCTION) worker.on('exit', this.opts.exitHandler ?? EMPTY_FUNCTION) worker.once('exit', () => { - this.workerNodes[this.getWorkerNodeKey(worker)].closeChannel() this.removeWorkerNode(worker) })