X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Fbenchmarks-utils.js;h=678b41d7634e56254c3cfb660738aea2cf8ee20d;hb=76369162548ededf89e0d513174a943cc330245c;hp=48311a3f04b773c0d6f540eaf659b2b00f3e08d7;hpb=fefd3cef3596e4e79dfeea1a1d6dfa39726e2ef5;p=poolifier.git diff --git a/benchmarks/benchmarks-utils.js b/benchmarks/benchmarks-utils.js index 48311a3f..678b41d7 100644 --- a/benchmarks/benchmarks-utils.js +++ b/benchmarks/benchmarks-utils.js @@ -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 )) { @@ -151,12 +154,16 @@ const runPoolifierPoolBenchmark = async ( LIST_FORMATTER.format(this.filter('fastest').map('name')) ) await pool.destroy() - pool = undefined resolve() }) .run({ async: true }) } catch (error) { - reject(error) + pool + .destroy() + .then(() => { + return reject(error) + }) + .catch(() => {}) } }) } @@ -249,7 +256,6 @@ const executeTaskFunction = data => { module.exports = { LIST_FORMATTER, - buildPoolifierPool, executeTaskFunction, generateRandomInteger, runPoolifierPoolBenchmark