1 const { isPrimary } = require('node:cluster')
3 const { ClusterWorker } = require('../../lib/index.cjs')
4 const { TaskFunctions } = require('../benchmarks-types.cjs')
5 const { executeTaskFunction } = require('../benchmarks-utils.cjs')
7 const taskFunction = data => {
9 data.function = data.function || TaskFunctions.factorial
10 data.debug = data.debug || false
11 const res = executeTaskFunction(data)
12 // eslint-disable-next-line @typescript-eslint/no-unused-expressions
13 data.debug === true && console.debug(`This is the main thread ${isPrimary}`)
17 module.exports = new ClusterWorker(taskFunction)