-const WorkerFunctions = {
- jsonIntegerSerialization: 'jsonIntegerSerialization',
- fibonacci: 'fibonacci',
- factorial: 'factorial'
-}
+const { WorkerFunctions } = require('./benchmarks-types')
async function runPoolifierTest (pool, { tasks, workerData }) {
return new Promise((resolve, reject) => {
.then(() => {
executions++
if (executions === tasks) {
- return resolve('FINISH')
+ return resolve({ ok: 1 })
}
return null
})
}
function generateRandomInteger (max = Number.MAX_SAFE_INTEGER, min = 0) {
+ if (max < min || max < 0 || min < 0) {
+ throw new RangeError('Invalid interval')
+ }
max = Math.floor(max)
- if (min) {
+ if (min != null && min !== 0) {
min = Math.ceil(min)
return Math.floor(Math.random() * (max - min + 1)) + min
}
}
}
-const LIST_FORMATTER = new Intl.ListFormat('en-US', {
- style: 'long',
- type: 'conjunction'
-})
-
module.exports = {
- LIST_FORMATTER,
WorkerFunctions,
executeWorkerFunction,
generateRandomInteger,