repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chore: generate documentation
[poolifier.git]
/
tests
/
worker-files
/
thread
/
asyncErrorWorker.js
diff --git
a/tests/worker-files/thread/asyncErrorWorker.js
b/tests/worker-files/thread/asyncErrorWorker.js
index d973f0a4d7625e826c19ad550c1f61a6f7836217..6bc0ae6b3b19226c557ce3455fe068b7b21e8bc4 100644
(file)
--- a/
tests/worker-files/thread/asyncErrorWorker.js
+++ b/
tests/worker-files/thread/asyncErrorWorker.js
@@
-1,14
+1,17
@@
'use strict'
'use strict'
-const { ThreadWorker, KillBehaviors } = require('../../../lib/index')
+const { ThreadWorker, KillBehaviors } = require('../../../lib')
+const { sleepWorkerFunction } = require('../../test-utils')
async function error (data) {
async function error (data) {
- return new Promise((resolve, reject) => {
- setTimeout(() => reject(new Error(data)), 2000)
- })
+ return sleepWorkerFunction(
+ data,
+ 2000,
+ true,
+ 'Error Message from ThreadWorker:async'
+ )
}
module.exports = new ThreadWorker(error, {
maxInactiveTime: 500,
}
module.exports = new ThreadWorker(error, {
maxInactiveTime: 500,
- async: true,
killBehavior: KillBehaviors.HARD
})
killBehavior: KillBehaviors.HARD
})