From 0dc838e376fd1fea7146350e99e487159e4ba40a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 20 Jul 2023 18:10:45 +0200 Subject: [PATCH] fix: close communication channel on error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/pools/abstract-pool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) }) -- 2.34.1