From 591cf84d6753eb91b43e2a291ee9937c9302b1df Mon Sep 17 00:00:00 2001 From: Sean Soper Date: Mon, 6 Aug 2012 11:32:05 -0400 Subject: [PATCH] add suicide to master to kill all workers --- index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.js b/index.js index cf9df24..58ca1c6 100644 --- a/index.js +++ b/index.js @@ -39,6 +39,12 @@ function ClusterFork() { return cluster.workers[workerId]; }; + this.suicide = function(cb) { + cluster.disconnect(function() { + cb(); + }); + }; + Object.defineProperty(emitted, 'nextWorker', { get: this.requestWorker }); Object.defineProperty(emitted, 'numWorkers', { value: numCPUs, writable: false });