fix: refine possible null exception fix at task response handling
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 17 Dec 2023 21:50:09 +0000 (22:50 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 17 Dec 2023 21:50:09 +0000 (22:50 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/pools/abstract-pool.ts

index 635b8af459363dc022671f089492f155b3470695..ea07dc8f0061ec0ccfb2a6adb92fc598c413a423 100644 (file)
@@ -1759,7 +1759,7 @@ export abstract class AbstractPool<
       this.afterTaskExecutionHook(workerNodeKey, message)
       this.workerChoiceStrategyContext.update(workerNodeKey)
       this.promiseResponseMap.delete(taskId as string)
-      workerNode.emit('taskFinished', taskId)
+      workerNode?.emit('taskFinished', taskId)
       if (this.opts.enableTasksQueue === true) {
         const workerNodeTasksUsage = workerNode.usage.tasks
         if (