repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test: switch to ESM
[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 0bf5d244758ce100683ea9c23faf114bd03428c8..c3bcdc8d0a3b3b94c7a596086f0dc7a9be9739a4 100644
(file)
--- a/
tests/worker-files/thread/asyncWorker.js
+++ b/
tests/worker-files/thread/asyncWorker.js
@@
-1,14
+1,12
@@
'use strict'
'use strict'
-const { ThreadWorker, KillBehaviors } = require('../../../lib/index')
+const { ThreadWorker, KillBehaviors } = require('../../../lib')
+const { sleepTaskFunction } = require('../../test-utils')
async function sleep (data) {
async function sleep (data) {
- return new Promise((resolve, reject) => {
- setTimeout(() => resolve(data), 2000)
- })
+ return sleepTaskFunction(data, 2000)
}
module.exports = new ThreadWorker(sleep, {
}
module.exports = new ThreadWorker(sleep, {
- maxInactiveTime: 500,
- async: true,
- killBehavior: KillBehaviors.HARD
+ killBehavior: KillBehaviors.HARD,
+ maxInactiveTime: 500
})
})