X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fcluster-worker.mjs;h=1d64fde30a19d82f0e4f52cb1781a7eab9efeae6;hb=c7ce27b892ebdd937bb0c333fbe76084aa5330be;hp=efbcf7b1cfd0bbf60c126f8f5af716b3c6a7dd45;hpb=dbca3be954130834defeb4084096272ecf660c5c;p=poolifier.git diff --git a/benchmarks/internal/cluster-worker.mjs b/benchmarks/internal/cluster-worker.mjs index efbcf7b1..1d64fde3 100644 --- a/benchmarks/internal/cluster-worker.mjs +++ b/benchmarks/internal/cluster-worker.mjs @@ -1,15 +1,14 @@ -import { isMaster } from 'cluster' +import { isPrimary } from 'node:cluster' import { ClusterWorker } from '../../lib/index.mjs' import { executeTaskFunction } from '../benchmarks-utils.mjs' import { TaskFunctions } from '../benchmarks-types.mjs' -const debug = false - -function taskFunction (data) { +const taskFunction = data => { data = data || {} data.function = data.function || TaskFunctions.jsonIntegerSerialization + data.debug = data.debug || false const res = executeTaskFunction(data) - debug === true && console.debug('This is the main thread ' + isMaster) + data.debug === true && console.debug(`This is the main thread ${isPrimary}`) return res }