Added prettier standard to support prettier and use it in combination with standard
[poolifier.git] / examples / staticExample.js
CommitLineData
c68d4281 1const FixedThreadPool = require('../lib/fixed')
c2dbbe2b 2let resolved = 0
cf9aa6c3 3const pool = new FixedThreadPool(15, './yourWorker.js', {
4 errorHandler: e => console.error(e),
5 onlineHandler: () => console.log('worker is online')
6})
3e460d6d 7
27006a3d 8const start = Date.now()
bf962cba 9const iterations = 1000
c2dbbe2b 10for (let i = 0; i <= iterations; i++) {
a32e02ba 11 pool.execute({}).then(res => {
c2dbbe2b 12 resolved++
3e460d6d 13 if (resolved === iterations) {
14 console.log('Time take is ' + (Date.now() - start))
c2dbbe2b 15 }
3e460d6d 16 })
6dc67cda 17}