X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fcluster%2Fworker.js;h=926278be77e4484fbbd9200af2b48fa76db27f26;hb=refs%2Ftags%2Fv2.4.8;hp=9817322c2870864d3b18537eae6952e50afe43e1;hpb=bdacc2d25f190728221f7fb8c8cd2aba175cb18d;p=poolifier.git diff --git a/benchmarks/internal/cluster/worker.js b/benchmarks/internal/cluster/worker.js index 9817322c..926278be 100644 --- a/benchmarks/internal/cluster/worker.js +++ b/benchmarks/internal/cluster/worker.js @@ -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 } }