repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chore: v2.4.3
[poolifier.git]
/
tests
/
worker-files
/
thread
/
asyncWorker.js
diff --git
a/tests/worker-files/thread/asyncWorker.js
b/tests/worker-files/thread/asyncWorker.js
index 25401cfb14dea2ff9fed837f138f349218ff7b34..2191a12e85240de96646fc2d2dfd4d10622ab5d0 100644
(file)
--- a/
tests/worker-files/thread/asyncWorker.js
+++ b/
tests/worker-files/thread/asyncWorker.js
@@
-1,10
+1,13
@@
'use strict'
'use strict'
-const { ThreadWorker } = require('../../../lib/index')
+const { ThreadWorker, KillBehaviors } = require('../../../lib/index')
+const TestUtils = require('../../test-utils')
async function sleep (data) {
async function sleep (data) {
- return new Promise((resolve, reject) => {
- setTimeout(() => resolve(data), 2000)
- })
+ return TestUtils.sleepWorkerFunction(data, 2000)
}
}
-module.exports = new ThreadWorker(sleep, { maxInactiveTime: 500, async: true })
+module.exports = new ThreadWorker(sleep, {
+ maxInactiveTime: 500,
+ async: true,
+ killBehavior: KillBehaviors.HARD
+})