const { FixedThreadPool } = require('poolifier')
-const pool = new FixedThreadPool(15, './multifunctionWorker.js', {
+const pool = new FixedThreadPool(15, './multiFunctionWorker.js', {
errorHandler: e => console.error(e),
- onlineHandler: () => console.log('worker is online')
+ onlineHandler: () => console.info('worker is online')
})
pool
- .execute({ fname: 'fn0', input: 'hello' })
- .then(res => console.log(res))
+ .execute({ text: 'hello' }, 'fn0')
+ .then(res => console.info(res))
.catch(err => console.error(err))
pool
- .execute({ fname: 'fn1', input: 'multifunction' })
- .then(res => console.log(res))
+ .execute({ text: 'multiple functions' }, 'fn1')
+ .then(res => console.info(res))
.catch(err => console.error(err))
-setTimeout(pool.destroy.bind(pool), 3000)
+setTimeout(pool.destroy(), 3000)