Permalink
Browse files

More Node 0.8 compat.

  • Loading branch information...
1 parent e9bb614 commit 56706a8abc428c9a423cb0608e7c646acda3e176 mde committed Jun 27, 2012
Showing with 12 additions and 7 deletions.
  1. +12 −7 lib/cluster/master.js
View
19 lib/cluster/master.js
@@ -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 () {
@@ -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);

0 comments on commit 56706a8

Please sign in to comment.