From ad3836edfc48e394c0271633acfa6952ef7be3d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 21 Dec 2023 11:57:58 +0100 Subject: [PATCH] fix: fix possible null exception at pool destroying MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- CHANGELOG.md | 5 +++++ src/pools/abstract-pool.ts | 2 +- tests/pools/abstract-pool.test.mjs | 5 ----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ba9080d..08678501 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fix default worker weight computation. +- Fix possible null exception at pool destroying. + ## [3.1.7] - 2023-12-20 ### Fixed diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 263d1302..9045b063 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -985,7 +985,7 @@ export abstract class AbstractPool< private async sendKillMessageToWorker (workerNodeKey: number): Promise { await new Promise((resolve, reject) => { if (this.workerNodes?.[workerNodeKey] == null) { - reject(new Error(`Invalid worker node key '${workerNodeKey}'`)) + resolve() return } const killMessageListener = (message: MessageValue): void => { diff --git a/tests/pools/abstract-pool.test.mjs b/tests/pools/abstract-pool.test.mjs index 0ea921f8..78fcd2da 100644 --- a/tests/pools/abstract-pool.test.mjs +++ b/tests/pools/abstract-pool.test.mjs @@ -1666,11 +1666,6 @@ describe('Abstract pool test suite', () => { await expect( pool.sendKillMessageToWorker(workerNodeKey) ).resolves.toBeUndefined() - await expect( - pool.sendKillMessageToWorker(numberOfWorkers) - ).rejects.toStrictEqual( - new Error(`Invalid worker node key '${numberOfWorkers}'`) - ) await pool.destroy() }) -- 2.34.1