fix: avoid possible nullish exception
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 4 Jan 2024 09:56:59 +0000 (10:56 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 4 Jan 2024 09:56:59 +0000 (10:56 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/pools/abstract-pool.ts

index 65ace6d907a20ca5a88d820d638c1aaa1a6f8bf1..0c366911a1ddb059f3c993f69bfdabfa8404173a 100644 (file)
@@ -1244,7 +1244,8 @@ export abstract class AbstractPool<
       ) {
         this.redistributeQueuedTasks(this.workerNodes.indexOf(workerNode))
       }
       ) {
         this.redistributeQueuedTasks(this.workerNodes.indexOf(workerNode))
       }
-      workerNode.terminate().catch(error => {
+      // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
+      workerNode?.terminate().catch(error => {
         this.emitter?.emit(PoolEvents.error, error)
       })
     })
         this.emitter?.emit(PoolEvents.error, error)
       })
     })