fix: prepare code to fix pool internal IPC for cluster worker
[poolifier.git] / benchmarks / internal / cluster-worker.mjs
CommitLineData
8a970421
JB
1import { isMaster } from 'cluster'
2import { ClusterWorker } from '../../lib/index.mjs'
8f810074
JB
3import { executeWorkerFunction } from '../benchmarks-utils.mjs'
4import { WorkerFunctions } from '../benchmarks-types.mjs'
57df5469 5
23ff945a
JB
6const debug = false
7
e102732c 8function workerFunction (data) {
2d2e32c2
JB
9 data = data || {}
10 data.function = data.function || WorkerFunctions.jsonIntegerSerialization
11 executeWorkerFunction(data)
23ff945a 12 debug === true && console.debug('This is the main thread ' + isMaster)
106744f7 13 return { ok: 1 }
14}
15
e102732c 16export default new ClusterWorker(workerFunction)