| 1 | import { isMaster } from 'cluster' |
| 2 | import { ClusterWorker } from '../../lib/index.mjs' |
| 3 | import { executeWorkerFunction } from '../benchmarks-utils.mjs' |
| 4 | import { WorkerFunctions } from '../benchmarks-types.mjs' |
| 5 | |
| 6 | const debug = false |
| 7 | |
| 8 | function workerFunction (data) { |
| 9 | data = data || {} |
| 10 | data.function = data.function || WorkerFunctions.jsonIntegerSerialization |
| 11 | executeWorkerFunction(data) |
| 12 | debug === true && console.debug('This is the main thread ' + isMaster) |
| 13 | return { ok: 1 } |
| 14 | } |
| 15 | |
| 16 | export default new ClusterWorker(workerFunction) |