From d42006c80a9c827e4c147e22f56bb3d789f578ce Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 4 Nov 2011 15:14:26 -0700 Subject: [PATCH] cluster: Remove eachWorker, workerCount unnecessary --- doc/api/cluster.markdown | 12 ------------ lib/cluster.js | 11 +---------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/doc/api/cluster.markdown b/doc/api/cluster.markdown index 7df84b1e4c..43a0190dc3 100644 --- a/doc/api/cluster.markdown +++ b/doc/api/cluster.markdown @@ -45,18 +45,6 @@ Boolean flags to determine if the current process is a master or a worker process in a cluster. A process `isMaster` if `process.env.NODE_WORKER_ID` is undefined. -### cluster.eachWorker(cb) - -Synchronously iterates over all of the workers. - - cluster.eachWorker(function(worker) { - console.log("worker pid=" + worker.pid); - }); - -### cluster.workerCount() - -Returns the number of workers. - ### Event: 'death' When any of the workers die the cluster module will emit the 'death' event. diff --git a/lib/cluster.js b/lib/cluster.js index 9e8a394785..589798ece3 100644 --- a/lib/cluster.js +++ b/lib/cluster.js @@ -128,7 +128,7 @@ function handleWorkerMessage(worker, message) { } -cluster.eachWorker = function(cb) { +function eachWorker(cb) { // This can only be called from the master. assert(cluster.isMaster); @@ -140,15 +140,6 @@ cluster.eachWorker = function(cb) { }; -cluster.workerCount = function() { - var c = 0; - cluster.eachWorker(function() { - c++; - }); - return c; -}; - - cluster.fork = function() { // This can only be called from the master. assert(cluster.isMaster);