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