X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2FstaticExample.js;h=d81e3484e89946374cc3056208e4d888a0162722;hb=464609011adfbe9330e28d448d462adcdffa64f5;hp=f125c477e20df4179c78984eb05f56fbb1a342ed;hpb=60fbd6d6188b0902d157fd0cde04d6af3a391e32;p=poolifier.git diff --git a/examples/staticExample.js b/examples/staticExample.js index f125c477..d81e3484 100644 --- a/examples/staticExample.js +++ b/examples/staticExample.js @@ -8,10 +8,14 @@ const pool = new FixedThreadPool(15, './yourWorker.js', { const start = Date.now() const iterations = 1000 for (let i = 0; i <= iterations; i++) { - pool.execute({}).then(res => { - resolved++ - if (resolved === iterations) { - console.log('Time take is ' + (Date.now() - start)) - } - }) + pool + .execute({}) + .then(res => { + resolved++ + if (resolved === iterations) { + return console.log('Time take is ' + (Date.now() - start)) + } + return null + }) + .catch(err => console.error(err)) }