1 const { FixedThreadPool
} = require('poolifier')
3 const pool
= new FixedThreadPool(15, './yourWorker.js', {
4 errorHandler
: e
=> console
.error(e
),
5 onlineHandler
: () => console
.log('worker is online')
8 const start
= Date
.now()
9 const iterations
= 1000
10 for (let i
= 1; i
<= iterations
; i
++) {
15 if (resolved
=== iterations
) {
16 return console
.log('Time take is ' + (Date
.now() - start
))
20 .catch(err
=> console
.error(err
))