cluster: Remove eachWorker, workerCount
unnecessary
This commit is contained in:
parent
86528489ec
commit
d42006c80a
@ -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`
|
process in a cluster. A process `isMaster` if `process.env.NODE_WORKER_ID`
|
||||||
is undefined.
|
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'
|
### Event: 'death'
|
||||||
|
|
||||||
When any of the workers die the cluster module will emit the 'death' event.
|
When any of the workers die the cluster module will emit the 'death' event.
|
||||||
|
@ -128,7 +128,7 @@ function handleWorkerMessage(worker, message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cluster.eachWorker = function(cb) {
|
function eachWorker(cb) {
|
||||||
// This can only be called from the master.
|
// This can only be called from the master.
|
||||||
assert(cluster.isMaster);
|
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() {
|
cluster.fork = function() {
|
||||||
// This can only be called from the master.
|
// This can only be called from the master.
|
||||||
assert(cluster.isMaster);
|
assert(cluster.isMaster);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user