From 0ead647361c78615f0d55fa6438aee072a424772 Mon Sep 17 00:00:00 2001 From: robo Date: Sun, 12 May 2013 00:32:35 +0530 Subject: [PATCH] worker state in stats --- lib/plugins/repl.js | 3 ++- lib/plugins/stats.js | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/plugins/repl.js b/lib/plugins/repl.js index 8389783..b1a4561 100644 --- a/lib/plugins/repl.js +++ b/lib/plugins/repl.js @@ -37,7 +37,7 @@ exports = module.exports = function(){ var server , sockets = []; - + master.dynState = []; // start repl function start(){ // TCP or unix-domain socket repl @@ -164,6 +164,7 @@ define('pids', function(master, sock){ define('kill', function(master, sock, id, signal){ var worker = master.children[id]; if (worker) { + master.dynState.push[id]; worker.proc.kill(signal); sock.write('sent \033[36m' + (signal || 'SIGTERM') + '\033[0m to worker #' + id + '\n'); } else { diff --git a/lib/plugins/stats.js b/lib/plugins/stats.js index 5b570c9..d49f8ec 100644 --- a/lib/plugins/stats.js +++ b/lib/plugins/stats.js @@ -208,11 +208,22 @@ repl.define('stats', function(master, sock){ master.children.forEach(function(worker){ var stats = '' + ,status = "alive"; , piped = []; + if (master.dynState) { + for(var i=0, max=master.dynstate.length; i