X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Fbenchmarks-utils.js;h=678b41d7634e56254c3cfb660738aea2cf8ee20d;hb=b22361f4474e4a63a7482741d98f0c58b4b03b4c;hp=aaf7521ff3044807e02078c2cde0f45c584586b1;hpb=229e9e73566ed1960ba5be0534fb3aa2eeb115eb;p=poolifier.git diff --git a/benchmarks/benchmarks-utils.js b/benchmarks/benchmarks-utils.js index aaf7521f..678b41d7 100644 --- a/benchmarks/benchmarks-utils.js +++ b/benchmarks/benchmarks-utils.js @@ -64,7 +64,7 @@ const runPoolifierPool = async (pool, { taskExecutions, workerData }) => { if (executions === taskExecutions) { resolve({ ok: 1 }) } - return null + return undefined }) .catch(err => { console.error(err) @@ -76,12 +76,15 @@ const runPoolifierPool = async (pool, { taskExecutions, workerData }) => { const runPoolifierPoolBenchmark = async ( name, - pool, + workerType, + poolType, + poolSize, { taskExecutions, workerData } ) => { + const pool = buildPoolifierPool(workerType, poolType, poolSize) + const suite = new Benchmark.Suite(name) return await new Promise((resolve, reject) => { try { - const suite = new Benchmark.Suite(name) for (const workerChoiceStrategy of Object.values( WorkerChoiceStrategies )) { @@ -155,7 +158,12 @@ const runPoolifierPoolBenchmark = async ( }) .run({ async: true }) } catch (error) { - reject(error) + pool + .destroy() + .then(() => { + return reject(error) + }) + .catch(() => {}) } }) } @@ -248,7 +256,6 @@ const executeTaskFunction = data => { module.exports = { LIST_FORMATTER, - buildPoolifierPool, executeTaskFunction, generateRandomInteger, runPoolifierPoolBenchmark