build(deps-dev): bump @types/node
[poolifier.git] / src / pools / abstract-pool.ts
index 628ad32ff8bac28bfb71a4355e79f7c7594e2236..08a955a93846ec406ee8a57053722549c56e476d 100644 (file)
@@ -1213,8 +1213,8 @@ export abstract class AbstractPool<
       const workerNodeKey = this.getWorkerNodeKeyByWorker(worker)
       const workerInfo = this.getWorkerInfo(workerNodeKey)
       workerInfo.ready = false
-      this.workerNodes[workerNodeKey].closeChannel()
       this.emitter?.emit(PoolEvents.error, error)
+      this.workerNodes[workerNodeKey].closeChannel()
       if (
         this.started &&
         !this.starting &&