repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bump @types/node from 14.14.27 to 14.14.28
[poolifier.git]
/
examples
/
staticExample.js
diff --git
a/examples/staticExample.js
b/examples/staticExample.js
index b9f7503fc8a4d656aa069f181c6ebdd679855d89..d81e3484e89946374cc3056208e4d888a0162722 100644
(file)
--- a/
examples/staticExample.js
+++ b/
examples/staticExample.js
@@
-1,4
+1,4
@@
-const
FixedThreadPool = require('../lib/fixed
')
+const
{ FixedThreadPool } = require('poolifier
')
let resolved = 0
const pool = new FixedThreadPool(15, './yourWorker.js', {
errorHandler: e => console.error(e),
let resolved = 0
const pool = new FixedThreadPool(15, './yourWorker.js', {
errorHandler: e => console.error(e),
@@
-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++) {
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))
}
}