From: Jérôme Benoit Date: Mon, 15 Jan 2024 20:23:20 +0000 (+0100) Subject: fix: fix possible null exception at task finishing X-Git-Tag: v3.1.19~6 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=16d7e943c24d86bdac0a26d7976d16d3d5f28e8f;p=poolifier.git fix: fix possible null exception at task finishing Signed-off-by: Jérôme Benoit --- diff --git a/CHANGELOG.md b/CHANGELOG.md index bd451997..936e2408 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fix possible null exception at task finishing handling. + ## [3.1.18] - 2024-01-06 ### Fixed diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 9cc0b338..bc77874f 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -1768,7 +1768,12 @@ export abstract class AbstractPool< this.promiseResponseMap.delete(taskId!) // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition workerNode?.emit('taskFinished', taskId) - if (this.opts.enableTasksQueue === true && !this.destroying) { + if ( + this.opts.enableTasksQueue === true && + !this.destroying && + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + workerNode != null + ) { const workerNodeTasksUsage = workerNode.usage.tasks if ( this.tasksQueueSize(workerNodeKey) > 0 &&