fix: prepare code to fix pool internal IPC for cluster worker
[poolifier.git] / benchmarks / internal / thread-worker.mjs
CommitLineData
8a970421
JB
1import { isMainThread } from 'worker_threads'
2import { ThreadWorker } from '../../lib/index.mjs'
8f810074
JB
3import { executeWorkerFunction } from '../benchmarks-utils.mjs'
4import { WorkerFunctions } from '../benchmarks-types.mjs'
8a970421
JB
5
6const debug = false
7
e102732c 8function workerFunction (data) {
8a970421
JB
9 data = data || {}
10 data.function = data.function || WorkerFunctions.jsonIntegerSerialization
11 executeWorkerFunction(data)
12 debug === true && console.debug('This is the main thread ' + isMainThread)
13 return { ok: 1 }
14}
15
e102732c 16export default new ThreadWorker(workerFunction)