refactor: register once internal worker error event listener
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 1 Apr 2024 17:08:00 +0000 (19:08 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 1 Apr 2024 17:08:00 +0000 (19:08 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/pools/abstract-pool.ts

index 9610f3416d13a368b6f7f5a605d70c4689b30176..0cec96ab5ac277dcb41336a89f3776806c956cc8 100644 (file)
@@ -1241,7 +1241,7 @@ export abstract class AbstractPool<
       'error',
       this.opts.errorHandler ?? EMPTY_FUNCTION
     )
-    workerNode.registerWorkerEventHandler('error', (error: Error) => {
+    workerNode.registerOnceWorkerEventHandler('error', (error: Error) => {
       workerNode.info.ready = false
       this.emitter?.emit(PoolEvents.error, error)
       if (