1 const { isPrimary
} = require('node:cluster')
2 const { ClusterWorker
} = require('../../lib')
3 const { executeTaskFunction
} = require('../benchmarks-utils.js')
4 const { TaskFunctions
} = require('../benchmarks-types.js')
6 const taskFunction
= data
=> {
8 data
.function = data
.function || TaskFunctions
.jsonIntegerSerialization
9 data
.debug
= data
.debug
|| false
10 const res
= executeTaskFunction(data
)
11 data
.debug
=== true && console
.debug(`This is the main thread ${isPrimary}`)
15 module
.exports
= new ClusterWorker(taskFunction
)