mirror of https://github.com/nodejs/node.git
cluster: restore v0.10.x setupMaster() behaviour
In v0.10.x, process.argv and process.execArgv would only be
evaluated and copied into cluster.settings on the first call to
cluster.setupMaster() (either directly or via cluster.fork()),
allowing them to be modified as needed before initializing the
settings.
In 41b75ca
the behaviour was changed so that these values are
initialized at the time of the first require('cluster').
Fixes #7670.
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
pull/5010/head
parent
61770f2125
commit
4cd522d157
|
@ -214,13 +214,7 @@ function masterInit() {
|
|||
cluster.workers = {};
|
||||
|
||||
var intercom = new EventEmitter;
|
||||
var settings = {
|
||||
args: process.argv.slice(2),
|
||||
exec: process.argv[1],
|
||||
execArgv: process.execArgv,
|
||||
silent: false
|
||||
};
|
||||
cluster.settings = settings;
|
||||
cluster.settings = {};
|
||||
|
||||
// XXX(bnoordhuis) Fold cluster.schedulingPolicy into cluster.settings?
|
||||
var schedulingPolicy = {
|
||||
|
@ -247,6 +241,12 @@ function masterInit() {
|
|||
cluster.setupMaster = function(options) {
|
||||
if (initialized === true) return;
|
||||
initialized = true;
|
||||
var settings = {
|
||||
args: process.argv.slice(2),
|
||||
exec: process.argv[1],
|
||||
execArgv: process.execArgv,
|
||||
silent: false
|
||||
};
|
||||
settings = util._extend(settings, options || {});
|
||||
// Tell V8 to write profile data for each process to a separate file.
|
||||
// Without --logfile=v8-%p.log, everything ends up in a single, unusable
|
||||
|
@ -282,10 +282,10 @@ function masterInit() {
|
|||
var workerEnv = util._extend({}, process.env);
|
||||
workerEnv = util._extend(workerEnv, env);
|
||||
workerEnv.NODE_UNIQUE_ID = '' + worker.id;
|
||||
worker.process = fork(settings.exec, settings.args, {
|
||||
worker.process = fork(cluster.settings.exec, cluster.settings.args, {
|
||||
env: workerEnv,
|
||||
silent: settings.silent,
|
||||
execArgv: createWorkerExecArgv(settings.execArgv, worker)
|
||||
silent: cluster.settings.silent,
|
||||
execArgv: createWorkerExecArgv(cluster.settings.execArgv, worker)
|
||||
});
|
||||
worker.process.once('exit', function(exitCode, signalCode) {
|
||||
worker.suicide = !!worker.suicide;
|
||||
|
|
Loading…
Reference in New Issue