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