Commit | Line | Data |
---|---|---|
8a970421 JB |
1 | import { isMaster } from 'cluster' |
2 | import { ClusterWorker } from '../../lib/index.mjs' | |
8f810074 JB |
3 | import { executeWorkerFunction } from '../benchmarks-utils.mjs' |
4 | import { WorkerFunctions } from '../benchmarks-types.mjs' | |
57df5469 | 5 | |
23ff945a JB |
6 | const debug = false |
7 | ||
e102732c | 8 | function workerFunction (data) { |
2d2e32c2 JB |
9 | data = data || {} |
10 | data.function = data.function || WorkerFunctions.jsonIntegerSerialization | |
30b963d4 | 11 | const res = executeWorkerFunction(data) |
23ff945a | 12 | debug === true && console.debug('This is the main thread ' + isMaster) |
30b963d4 | 13 | return res |
106744f7 | 14 | } |
15 | ||
e102732c | 16 | export default new ClusterWorker(workerFunction) |