build(deps-dev): bump expect from 29.6.4 to 29.7.0
[poolifier.git] / benchmarks / versus-external-pools / fixed-piscina.mjs
index f13b996a7aead8e3a2eeeecfee16cf06a59407de..97150f5e07132b4f99388ad56d7ee87f8af0acf6 100644 (file)
@@ -1,6 +1,6 @@
-// IMPORT LIBRARIES
 import Piscina from 'piscina'
-// FINISH IMPORT LIBRARIES
+import { executeAsyncFn } from '../benchmarks-utils.mjs'
+
 const size = parseInt(process.env.POOL_SIZE)
 const iterations = parseInt(process.env.NUM_ITERATIONS)
 const data = {
@@ -17,13 +17,13 @@ const piscina = new Piscina({
 })
 
 async function run () {
-  const promises = []
+  const promises = new Set()
   for (let i = 0; i < iterations; i++) {
-    promises.push(piscina.run(data))
+    promises.add(piscina.run(data))
   }
   await Promise.all(promises)
   // eslint-disable-next-line n/no-process-exit
   process.exit()
 }
 
-await run()
+await executeAsyncFn(run)