Benchmarks: fix workload function
[poolifier.git] / benchmarks / internal / cluster / worker.js
CommitLineData
57df5469 1'use strict'
23ff945a 2const { isMaster } = require('cluster')
be0676b3 3const { ClusterWorker } = require('../../../lib/index')
e4bc7a49
JB
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)