Merge branch 'master' into combined-prs-branch
[poolifier.git] / benchmarks / versus-external-pools / dynamic-node-worker-threads-pool.mjs
index 743b01d64e2b6086af087311809825d56c533f6d..fcb1d84c29ee43bcb5c615418d98cfe3819b84ad 100644 (file)
@@ -2,7 +2,7 @@
 import { DynamicPool } from 'node-worker-threads-pool'
 // FINISH IMPORT LIBRARIES
 // IMPORT FUNCTION TO BENCH
-import functionToBench from './functions/function-to-bench.mjs'
+import functionToBench from './functions/function-to-bench.js'
 // FINISH IMPORT FUNCTION TO BENCH
 const size = parseInt(process.env.POOL_SIZE)
 const iterations = parseInt(process.env.NUM_ITERATIONS)
@@ -15,12 +15,13 @@ const data = {
 const pool = new DynamicPool(size)
 
 async function run () {
-  const promises = []
+  const promises = new Set()
   for (let i = 0; i < iterations; i++) {
-    promises.push(
+    promises.add(
       pool.exec({
         task: functionToBench,
-        param: data
+        param: data,
+        timeout: 60000 // this is the same as poolifier default
       })
     )
   }