repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Create codeql-analysis.yml
[poolifier.git]
/
examples
/
multiFunctionExample.js
diff --git
a/examples/multiFunctionExample.js
b/examples/multiFunctionExample.js
index d1314aa94149fe7324fda3df0b91e240f9865532..93d4e78b3d0465b35b823fd18dc2cbc203c66e31 100644
(file)
--- a/
examples/multiFunctionExample.js
+++ b/
examples/multiFunctionExample.js
@@
-1,12
+1,16
@@
const { FixedThreadPool } = require('poolifier')
const { FixedThreadPool } = require('poolifier')
-const pool = new FixedThreadPool(15, './multi
f
unctionWorker.js', {
+const pool = new FixedThreadPool(15, './multi
F
unctionWorker.js', {
errorHandler: e => console.error(e),
onlineHandler: () => console.log('worker is online')
})
errorHandler: e => console.error(e),
onlineHandler: () => console.log('worker is online')
})
-pool.execute({ fname: 'fn0', input: 'hello' }).then(res => console.log(res))
pool
pool
- .execute({ f
name: 'fn1', input: 'multifunction
' })
+ .execute({ f
unctionName: 'fn0', input: 'hello
' })
.then(res => console.log(res))
.then(res => console.log(res))
+ .catch(err => console.error(err))
+pool
+ .execute({ functionName: 'fn1', input: 'multiple functions' })
+ .then(res => console.log(res))
+ .catch(err => console.error(err))
setTimeout(pool.destroy.bind(pool), 3000)
setTimeout(pool.destroy.bind(pool), 3000)