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