Remove usage of nodemon
[poolifier.git] / examples / staticExample.js
... / ...
CommitLineData
1const FixedThreadPool = require('../lib/fixed')
2let resolved = 0
3const pool = new FixedThreadPool(15, './yourWorker.js', {
4 errorHandler: e => console.error(e),
5 onlineHandler: () => console.log('worker is online')
6})
7
8const start = Date.now()
9const iterations = 1000
10for (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}