Merge branch 'master' into elu-strategy
[poolifier.git] / benchmarks / versus-external-pools / dynamic-workerpool.js
index 557e45e6eed125969cae9a736eb28f6994371d91..04d90ab209f4365968b6d7ecf2a6d130ed74779e 100644 (file)
@@ -1,14 +1,18 @@
 // IMPORT LIBRARIES
 const workerpool = require('workerpool')
 // FINISH IMPORT LIBRARIES
-const size = process.env.POOL_SIZE
-const iterations = process.env.NUM_ITERATIONS
-const dataArray = ['MYBENCH', process.env['TASK_TYPE']]
+const size = parseInt(process.env.POOL_SIZE)
+const iterations = parseInt(process.env.NUM_ITERATIONS)
+const dataArray = [
+  'MYBENCH',
+  process.env.TASK_TYPE,
+  parseInt(process.env.TASK_SIZE)
+]
 
 const workerPool = workerpool.pool(
   './workers/workerpool/function-to-bench-worker.js',
   {
-    minWorkers: Number(size),
+    minWorkers: size,
     maxWorkers: size * 3,
     workerType: 'thread'
   }
@@ -20,6 +24,7 @@ async function run () {
     promises.push(workerPool.exec('functionToBench', dataArray))
   }
   await Promise.all(promises)
+  // eslint-disable-next-line n/no-process-exit
   process.exit()
 }