diff --git a/lib/Broker.js b/lib/Broker.js index ea7f23c..5a61f2a 100644 --- a/lib/Broker.js +++ b/lib/Broker.js @@ -15,8 +15,6 @@ var putils = require('./utils'); var BaseController = require('./BrokerController'); -var HEARTBEAT_LIVENESS = 3; - function Broker(endpoint, conf) { this.services = {}; this.workers = new Map(); @@ -24,6 +22,7 @@ function Broker(endpoint, conf) { this.conf = { heartbeat: 2500, + heartbeatLiveness: 3, dmode: 'load', name: 'B' + uuid.v4(), intch: 'tcp://127.0.0.1:55550' @@ -244,7 +243,7 @@ Broker.prototype.onClient = function(msg) { } else if (type === 'worker') { var worker = this.workers.get(msg[4]); if (worker) { - worker.liveness = HEARTBEAT_LIVENESS; + worker.liveness = this.conf.heartbeatLiveness; } } } else { @@ -285,7 +284,7 @@ Broker.prototype.onWorker = function(msg) { return; } - worker.liveness = HEARTBEAT_LIVENESS; + worker.liveness = this.conf.heartbeatLiveness; if (type == MDP.W_REPLY || type == MDP.W_REPLY_PARTIAL || type == MDP.W_REPLY_REJECT) { var rid = msg[5]; @@ -416,7 +415,7 @@ Broker.prototype.workerRequire = function(workerId) { var worker = { workerId: workerId, - liveness: HEARTBEAT_LIVENESS, + liveness: this.conf.heartbeatLiveness, rids: new Map(), opts: { concurrency: 100 @@ -516,7 +515,7 @@ Broker.prototype.workersCheck = function() { return; } - if (worker.liveness < HEARTBEAT_LIVENESS) { + if (worker.liveness < self.conf.heartbeatLiveness) { self.send([workerId, MDP.WORKER, MDP.W_HEARTBEAT]); } }); diff --git a/package.json b/package.json index 865fba6..45dae82 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "pigato", - "version": "0.0.46", + "version": "0.0.47", "private": false, - "description": "An high-performance Node.js microservices framework based on ZeroMQ", + "description": "A high-performance Node.js microservices framework based on ZeroMQ", "author": "prdn (http://ardoino.com/)", "keywords": [ "pigato",