build(deps-dev): bump @types/node
[poolifier.git] / benchmarks / internal / cluster-worker.mjs
... / ...
CommitLineData
1import { isMaster } from '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 ' + isMaster)
13 return res
14}
15
16export default new ClusterWorker(taskFunction)