Comparing version 0.2.4 to 0.2.5
@@ -39,2 +39,3 @@ /* | ||
cluster: true, | ||
timeout: 500, | ||
ecv: { | ||
@@ -41,0 +42,0 @@ monitor: '/', |
@@ -21,3 +21,3 @@ /* | ||
// | ||
// A TCP server cluster | ||
// A HTTP server cluster | ||
@@ -24,0 +24,0 @@ var serving = true; |
@@ -214,3 +214,3 @@ /* | ||
else { | ||
var listening = false, conns = 0, totalConns = 0; | ||
var listening = false, conns = 0, totalConns = 0, timedoutConns = 0; | ||
process.on('SIGINT', function() { | ||
@@ -249,12 +249,15 @@ self.emitter.emit('SIGINT', { | ||
// Workers are net.Servers. | ||
app.listen(this.options.port, function() { | ||
console.log('Worker ' + process.pid + ' listening on ' + self.options.port); | ||
if(self.options.ecv) { | ||
ecv.enable(app, self.options.port, self.options.ecvPath, self.options.ecv.monitor, function(data) { | ||
return true; | ||
}); | ||
} | ||
cb(); | ||
}); | ||
// Workers are net.Servers | ||
var ports = _.isArray(this.options.port) ? this.options.port : [this.options.port]; | ||
_.each(ports, function(port) { | ||
app.listen(port, function() { | ||
console.log('Worker ' + process.pid + ' listening on ' + port); | ||
if(self.options.ecv) { | ||
ecv.enable(app, port, self.options.ecvPath, self.options.ecv.monitor, function(data) { | ||
return true; | ||
}); | ||
} | ||
cb(); | ||
}); | ||
}) | ||
@@ -267,2 +270,3 @@ // Set time out on idle sockets | ||
function () { | ||
timedoutConns++; | ||
self.emitter.emit('warning', { | ||
@@ -288,3 +292,18 @@ message: 'Client socket timed out' | ||
}, 100); | ||
// Heartbeat - make sure to clear this on 'close' | ||
// TODO: Other details to include | ||
var heartbeat = setInterval(function () { | ||
self.emitter.emit('heartbeat', { | ||
pid: process.pid, | ||
uptime: Math.round(process.uptime()), | ||
freemem: os.freemem(), | ||
totalConnections: totalConns, | ||
pendingConnections: conns, | ||
timedoutConnections: timedoutConns | ||
}); | ||
}, 60000); | ||
app.on('close', function() { | ||
clearInterval(heartbeat); | ||
clearInterval(recycle); | ||
@@ -291,0 +310,0 @@ }) |
{ | ||
"author": "ql.io", | ||
"contributors": [{ | ||
"name": "Subbu Allamaraju", | ||
"email": "subbu@ebaysf.com" | ||
}], | ||
"name": "cluster2", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"repository": { | ||
@@ -6,0 +10,0 @@ "type": "git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75520
24
1201
5