Bump eslint-plugin-jsdoc from 32.1.1 to 32.2.0 (#229)
[poolifier.git] / examples / multiFunctionExample.js
CommitLineData
60fbd6d6 1const { FixedThreadPool } = require('poolifier')
5c5a1fb7 2const pool = new FixedThreadPool(15, './multiFunctionWorker.js', {
cf9aa6c3 3 errorHandler: e => console.error(e),
4 onlineHandler: () => console.log('worker is online')
5})
106744f7 6
583a27ce 7pool
5c5a1fb7 8 .execute({ functionName: 'fn0', input: 'hello' })
583a27ce
JB
9 .then(res => console.log(res))
10 .catch(err => console.error(err))
cf9aa6c3 11pool
5c5a1fb7 12 .execute({ functionName: 'fn1', input: 'multiple functions' })
cf9aa6c3 13 .then(res => console.log(res))
583a27ce 14 .catch(err => console.error(err))
106744f7 15
16setTimeout(pool.destroy.bind(pool), 3000)