build(deps-dev): bump @types/node
[poolifier.git] / benchmarks / internal / cluster-worker.mjs
index 50e4a324a98a580206db83a3dc3dc40bf80efc32..60876bebef04bf97e3a866209fe65792bf6d985f 100644 (file)
@@ -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 yourFunction (data) {
+const taskFunction = data => {
   data = data || {}
-  data.function = data.function || WorkerFunctions.jsonIntegerSerialization
-  executeWorkerFunction(data)
+  data.function = data.function || TaskFunctions.jsonIntegerSerialization
+  const res = executeTaskFunction(data)
   debug === true && console.debug('This is the main thread ' + isMaster)
-  return { ok: 1 }
+  return res
 }
 
-export default new ClusterWorker(yourFunction)
+export default new ClusterWorker(taskFunction)