X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fcluster%2Fworker.js;h=29005f9c219bc9b932317d291dc8f059a2819d47;hb=767d1512978a4a45bd79189e67f703ce217342ca;hp=9817322c2870864d3b18537eae6952e50afe43e1;hpb=bdacc2d25f190728221f7fb8c8cd2aba175cb18d;p=poolifier.git diff --git a/benchmarks/internal/cluster/worker.js b/benchmarks/internal/cluster/worker.js index 9817322c..29005f9c 100644 --- a/benchmarks/internal/cluster/worker.js +++ b/benchmarks/internal/cluster/worker.js @@ -1,10 +1,15 @@ 'use strict' +const { isMaster } = require('cluster') const { ClusterWorker } = require('../../../lib/index') -const { jsonIntegerSerialization } = require('../benchmark-utils') +const { WorkerFunctions, executeWorkerFunction } = require('../benchmark-utils') + +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 } }