From: Jérôme Benoit Date: Tue, 2 Dec 2025 13:26:48 +0000 (+0100) Subject: fix(benchmarks): destroy pool in the error case X-Git-Tag: v5.2.0~60 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ef7e70bfd44f6e4ffe1b70ffffe569bc70182f7b;p=poolifier.git fix(benchmarks): destroy pool in the error case Signed-off-by: Jérôme Benoit --- 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() + } } }