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