Commit | Line | Data |
---|---|---|
1 | const FixedThreadPool = require('../lib/fixed') | |
2 | const pool = new FixedThreadPool(15, | |
3 | './multifunctionWorker.js', | |
4 | { errorHandler: (e) => console.error(e), onlineHandler: () => console.log('worker is online') }) | |
5 | ||
6 | pool.execute({ fname: 'fn0', input: 'hello' }).then(res => console.log(res)) | |
7 | pool.execute({ fname: 'fn1', input: 'multifunction' }).then(res => console.log(res)) | |
8 | ||
9 | setTimeout(pool.destroy.bind(pool), 3000) |