repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
docs: update benchmarks vs. external pools
[poolifier.git]
/
tests
/
test-utils.js
diff --git
a/tests/test-utils.js
b/tests/test-utils.js
index cba320a75896311e11d7b0b69ff27cf721dd0807..ceaff7be4c605140c546d1773493b56dcfb1e309 100644
(file)
--- a/
tests/test-utils.js
+++ b/
tests/test-utils.js
@@
-1,17
+1,17
@@
const { WorkerFunctions } = require('./test-types')
class TestUtils {
const { WorkerFunctions } = require('./test-types')
class TestUtils {
- static async waitWorkerE
xits (pool, numberOfExit
EventsToWait) {
+ static async waitWorkerE
vents (pool, workerEvent, numberOf
EventsToWait) {
return new Promise(resolve => {
return new Promise(resolve => {
- let e
xitE
vents = 0
- if (numberOfE
xitE
ventsToWait === 0) {
- resolve(e
xitE
vents)
+ let events = 0
+ if (numberOfEventsToWait === 0) {
+ resolve(events)
}
for (const workerNode of pool.workerNodes) {
}
for (const workerNode of pool.workerNodes) {
- workerNode.worker.on(
'exit'
, () => {
- ++e
xitE
vents
- if (e
xitEvents === numberOfExit
EventsToWait) {
- resolve(e
xitE
vents)
+ workerNode.worker.on(
workerEvent
, () => {
+ ++events
+ if (e
vents === numberOf
EventsToWait) {
+ resolve(events)
}
})
}
}
})
}
@@
-81,7
+81,7
@@
class TestUtils {
* @returns {number} - The nth fibonacci number.
*/
static fibonacci (n) {
* @returns {number} - The nth fibonacci number.
*/
static fibonacci (n) {
- if (n <= 1) return
1
+ if (n <= 1) return
n
return TestUtils.fibonacci(n - 1) + TestUtils.fibonacci(n - 2)
}
return TestUtils.fibonacci(n - 1) + TestUtils.fibonacci(n - 2)
}