cluster: do not synchronously emit 'setup' event
This is a problem present in both v0.10, and v0.11, where the 'setup' event is synchronously emitted by `cluster.setupMaster()`, a mostly harmless anti-pattern.
This commit is contained in:
parent
dce35146e0
commit
876d3bd85a
@ -269,7 +269,9 @@ function masterInit() {
|
|||||||
process._debugProcess(cluster.workers[key].process.pid);
|
process._debugProcess(cluster.workers[key].process.pid);
|
||||||
});
|
});
|
||||||
|
|
||||||
cluster.emit('setup');
|
process.nextTick(function() {
|
||||||
|
cluster.emit('setup');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var ids = 0;
|
var ids = 0;
|
||||||
|
@ -39,6 +39,12 @@ if (cluster.isWorker) {
|
|||||||
|
|
||||||
var totalWorkers = 2;
|
var totalWorkers = 2;
|
||||||
|
|
||||||
|
// Setup master
|
||||||
|
cluster.setupMaster({
|
||||||
|
args: ['custom argument'],
|
||||||
|
silent: true
|
||||||
|
});
|
||||||
|
|
||||||
cluster.once('setup', function() {
|
cluster.once('setup', function() {
|
||||||
checks.setupEvent = true;
|
checks.setupEvent = true;
|
||||||
|
|
||||||
@ -51,12 +57,6 @@ if (cluster.isWorker) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Setup master
|
|
||||||
cluster.setupMaster({
|
|
||||||
args: ['custom argument'],
|
|
||||||
silent: true
|
|
||||||
});
|
|
||||||
|
|
||||||
var correctIn = 0;
|
var correctIn = 0;
|
||||||
|
|
||||||
cluster.on('online', function lisenter(worker) {
|
cluster.on('online', function lisenter(worker) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user