Commit | Line | Data |
---|---|---|
57df5469 | 1 | 'use strict' |
23ff945a | 2 | const { isMaster } = require('cluster') |
cdace0e5 JB |
3 | const { ClusterWorker } = require('../../lib') |
4 | const { executeWorkerFunction } = require('../benchmarks-utils') | |
5 | const { WorkerFunctions } = require('../benchmarks-types') | |
57df5469 | 6 | |
23ff945a JB |
7 | const debug = false |
8 | ||
106744f7 | 9 | function 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 | 17 | module.exports = new ClusterWorker(yourFunction) |