From cdaecaee1c7fa5c412daf29f2db41470506793ac Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 4 Jan 2024 00:29:13 +0100 Subject: [PATCH] fix: ensure worker node is defined before emitting MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/pools/abstract-pool.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 47411563..65ace6d9 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -1748,7 +1748,8 @@ export abstract class AbstractPool< this.afterTaskExecutionHook(workerNodeKey, message) // eslint-disable-next-line @typescript-eslint/no-non-null-assertion this.promiseResponseMap.delete(taskId!) - workerNode.emit('taskFinished', taskId) + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + workerNode?.emit('taskFinished', taskId) if (this.opts.enableTasksQueue === true && !this.destroying) { const workerNodeTasksUsage = workerNode.usage.tasks if ( -- 2.34.1