Switch to push-protected GH action for typedoc usage
[poolifier.git] / benchmarks / internal / cluster / worker.js
index 9817322c2870864d3b18537eae6952e50afe43e1..926278be77e4484fbbd9200af2b48fa76db27f26 100644 (file)
@@ -1,10 +1,16 @@
 'use strict'
+const { isMaster } = require('cluster')
 const { ClusterWorker } = require('../../../lib/index')
-const { jsonIntegerSerialization } = require('../benchmark-utils')
+const { executeWorkerFunction } = require('../../benchmarks-utils')
+const { WorkerFunctions } = require('../../benchmarks-types')
+
+const debug = false
 
 function yourFunction (data) {
-  jsonIntegerSerialization(1000)
-  // console.log('This is the main thread ' + isMaster)
+  data = data || {}
+  data.function = data.function || WorkerFunctions.jsonIntegerSerialization
+  executeWorkerFunction(data)
+  debug === true && console.debug('This is the main thread ' + isMaster)
   return { ok: 1 }
 }