Skip to content

Commit

Permalink
More Node 0.8 compat.
Browse files Browse the repository at this point in the history
  • Loading branch information
mde committed Jun 27, 2012
1 parent e9bb614 commit 56706a8
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lib/cluster/master.js
Expand Up @@ -22,14 +22,18 @@ var processModes = {
};

Master = function () {
var self = this;
var self = this
, handleExit = function (worker) {
// Node 0.8 vs. 0.6
var proc = worker.process || worker
, id = proc.pid.toString();
self.handleWorkerExit(id);
};
this.init();
// Clustering-only
cluster.addListener('death', function (worker) {
var proc = worker.process || worker
, id = proc.pid.toString();
self.handleWorkerExit(id);
});
// Node 0.6
cluster.addListener('death', handleExit);
// Node 0.8
cluster.addListener('exit', handleExit);
};

Master.prototype = new (function () {
Expand Down Expand Up @@ -323,6 +327,7 @@ Master.prototype = new (function () {
var self = this
, retireAt = dt || (new Date()).getTime() + this.config.rotationWindow
, w = cluster.fork()
// Node 0.8 vs. 0.6
, proc = w.process || w
, id = proc.pid.toString()
, data = new WorkerData(id, w);
Expand Down

0 comments on commit 56706a8

Please sign in to comment.