refactor: use helper to flag worker node as not ready
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 21 Oct 2023 17:46:36 +0000 (19:46 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 21 Oct 2023 17:46:36 +0000 (19:46 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/pools/abstract-pool.ts

index ef5ebeadd6ad08e3ce6a37eb04aa425280a618af..2545d6a980a1a69e3bd18bcbc11af8b514dda503 100644 (file)
@@ -1219,8 +1219,8 @@ export abstract class AbstractPool<
     worker.on('error', this.opts.errorHandler ?? EMPTY_FUNCTION)
     worker.on('error', error => {
       const workerNodeKey = this.getWorkerNodeKeyByWorker(worker)
+      this.flagWorkerNodeAsNotReady(workerNodeKey)
       const workerInfo = this.getWorkerInfo(workerNodeKey)
-      workerInfo.ready = false
       this.emitter?.emit(PoolEvents.error, error)
       this.workerNodes[workerNodeKey].closeChannel()
       if (