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