From ef7e70bfd44f6e4ffe1b70ffffe569bc70182f7b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 2 Dec 2025 14:26:48 +0100 Subject: [PATCH] fix(benchmarks): destroy pool in the error case MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- benchmarks/benchmarks-utils.mjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/benchmarks/benchmarks-utils.mjs b/benchmarks/benchmarks-utils.mjs index 83013e676..4cf116817 100644 --- a/benchmarks/benchmarks-utils.mjs +++ b/benchmarks/benchmarks-utils.mjs @@ -66,9 +66,10 @@ export const runPoolifierBenchmarkTinyBench = async ( { taskExecutions, workerData } ) => { const bmfResults = {} + let pool try { const bench = new Bench() - const pool = buildPoolifierPool(workerType, poolType, poolSize) + pool = buildPoolifierPool(workerType, poolType, poolSize) for (const workerChoiceStrategy of Object.values(WorkerChoiceStrategies)) { for (const enableTasksQueue of [false, true]) { @@ -136,7 +137,6 @@ export const runPoolifierBenchmarkTinyBench = async ( const tasks = await bench.run() console.table(bench.table()) - await pool.destroy() for (const task of tasks) { if ( @@ -163,6 +163,10 @@ export const runPoolifierBenchmarkTinyBench = async ( } catch (error) { console.error(error) return bmfResults + } finally { + if (pool != null) { + await pool.destroy() + } } } -- 2.43.0