chore: v2.4.12
[poolifier.git] / benchmarks / internal / cluster-worker.js
CommitLineData
57df5469 1'use strict'
23ff945a 2const { isMaster } = require('cluster')
cdace0e5
JB
3const { ClusterWorker } = require('../../lib')
4const { executeWorkerFunction } = require('../benchmarks-utils')
5const { WorkerFunctions } = require('../benchmarks-types')
57df5469 6
23ff945a
JB
7const debug = false
8
106744f7 9function yourFunction (data) {
2d2e32c2
JB
10 data = data || {}
11 data.function = data.function || WorkerFunctions.jsonIntegerSerialization
12 executeWorkerFunction(data)
23ff945a 13 debug === true && console.debug('This is the main thread ' + isMaster)
106744f7 14 return { ok: 1 }
15}
16
325f50bc 17module.exports = new ClusterWorker(yourFunction)