Skip to content

Commit

Permalink
Bandaid server process-restart for dev-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mde committed Sep 18, 2012
1 parent eb27b04 commit ec4204a
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions lib/cluster/master.js
Expand Up @@ -170,13 +170,13 @@ Master.prototype = new (function () {
if (self.processMode == processModes.WATCH_FILES) {
if (!data.killed) {
killWorker = true;
self.stderrLog.warning('Code changed, killing ' +
worker.pid + ', cycling ...');
self.stdoutLog.info('Code changed, killing ' +
worker.process.pid + ', cycling ...');
}
}

if (killWorker) {
self.killWorker(worker.pid);
self.killWorker(worker.process.pid);
}
});

Expand Down Expand Up @@ -253,11 +253,17 @@ Master.prototype = new (function () {
this.createWorkers = function () {
var configCount = this.config.workers
, currentCount = this.workers.count
, needed = configCount - currentCount
, needed
, rotationWindow = this.config.rotationWindow
, staggerInterval = rotationWindow / needed
, retirement = (new Date()).getTime() + rotationWindow
, msg;

if (this.processMode == processModes.WATCH_FILES) {
currentCount = 0;
}
needed = configCount - currentCount

if (needed) {
msg = 'Creating ' + needed + ' worker process';
msg += needed > 1 ? 'es.' : '.';
Expand Down Expand Up @@ -323,10 +329,10 @@ Master.prototype = new (function () {
, id = pid.toString()
, worker = this.workers.getItem(id);
worker.killed = true;
try {
//try {
process.kill(pid);
}
catch(e) {}
//}
//catch(e) {}
// handleWorkerExit gets called on the process die/exit event.
// If for some reason it doesn't get called, we still want
// the process removed from the list of active proceses
Expand Down

0 comments on commit ec4204a

Please sign in to comment.