fix: register worker error callback once
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 4 Apr 2024 09:13:37 +0000 (11:13 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 4 Apr 2024 09:13:37 +0000 (11:13 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/worker/WorkerSet.ts

index b09ea711df718bbcd508dfba52dd99112e90b285..c45e6a617147edce428800d8a777178eea9b53ea 100644 (file)
@@ -182,7 +182,7 @@ export class WorkerSet<D extends WorkerData, R extends WorkerData> extends Worke
       }
     })
     worker.on('error', this.workerOptions.poolOptions?.errorHandler ?? EMPTY_FUNCTION)
-    worker.on('error', error => {
+    worker.once('error', error => {
       this.emitter?.emit(WorkerSetEvents.error, error)
       if (
         this.workerOptions.poolOptions?.restartWorkerOnError === true &&