Navigation Menu

Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
cluster: Remove eachWorker, workerCount
Browse files Browse the repository at this point in the history
unnecessary
  • Loading branch information
ry committed Nov 4, 2011
1 parent 8652848 commit d42006c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
12 changes: 0 additions & 12 deletions doc/api/cluster.markdown
Expand Up @@ -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.
Expand Down
11 changes: 1 addition & 10 deletions lib/cluster.js
Expand Up @@ -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);

Expand All @@ -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);
Expand Down

2 comments on commit d42006c

@jtokoph
Copy link

@jtokoph jtokoph commented on d42006c Nov 7, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still a reference to cluster.eachWorker on line 83 of cluster.js:
https://github.com/joyent/node/blob/d42006c80a9c827e4c147e22f56bb3d789f578ce/lib/cluster.js#L83

@bnoordhuis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Fixed in 105d178.

Please sign in to comment.