X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=benchmarks%2Finternal%2Fcluster-worker.mjs;h=bc3548394616f1426f48dda0c8a4e9719937e15d;hb=968dbbe773c54624ebead8c704dbc10b4b1abe54;hp=2ec78054e655f25f181e888c0f90b6bd28ba4b66;hpb=c2d2417cb80d8c14637fe6a19d58bcf5ce18ae98;p=poolifier.git diff --git a/benchmarks/internal/cluster-worker.mjs b/benchmarks/internal/cluster-worker.mjs index 2ec78054..bc354839 100644 --- a/benchmarks/internal/cluster-worker.mjs +++ b/benchmarks/internal/cluster-worker.mjs @@ -1,16 +1,16 @@ import { isMaster } from 'cluster' import { ClusterWorker } from '../../lib/index.mjs' -import { executeWorkerFunction } from '../benchmarks-utils.mjs' -import { WorkerFunctions } from '../benchmarks-types.mjs' +import { executeTaskFunction } from '../benchmarks-utils.mjs' +import { TaskFunctions } from '../benchmarks-types.mjs' const debug = false -function workerFunction (data) { +const taskFunction = (data) => { data = data || {} - data.function = data.function || WorkerFunctions.jsonIntegerSerialization - const res = executeWorkerFunction(data) + data.function = data.function || TaskFunctions.jsonIntegerSerialization + const res = executeTaskFunction(data) debug === true && console.debug('This is the main thread ' + isMaster) return res } -export default new ClusterWorker(workerFunction) +export default new ClusterWorker(taskFunction)