build(deps-dev): bump expect from 29.6.4 to 29.7.0
[poolifier.git] / benchmarks / internal / cluster-worker.mjs
CommitLineData
a449b585 1import { isPrimary } from 'node:cluster'
8a970421 2import { ClusterWorker } from '../../lib/index.mjs'
dbca3be9
JB
3import { executeTaskFunction } from '../benchmarks-utils.mjs'
4import { TaskFunctions } from '../benchmarks-types.mjs'
57df5469 5
23ff945a
JB
6const debug = false
7
041dc05b 8const taskFunction = data => {
2d2e32c2 9 data = data || {}
dbca3be9
JB
10 data.function = data.function || TaskFunctions.jsonIntegerSerialization
11 const res = executeTaskFunction(data)
1c132fec 12 debug === true && console.debug(`This is the main thread ${isPrimary}`)
30b963d4 13 return res
106744f7 14}
15
dbca3be9 16export default new ClusterWorker(taskFunction)