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