Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cluster2

Package Overview
Dependencies
Maintainers
3
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cluster2 - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

pids/master.44267.pid

27

lib/index.js

@@ -113,15 +113,22 @@ /*

// masters hanging around together
var server = net.createServer();
server.on('error', function (e) {
if(e.code === 'EADDRINUSE') {
console.log('Address in use ...');
process.exit(-1);
}
var ports = _.isArray(self.options.port) ? self.options.port : [self.options.port];
_.each(ports, function(port) {
exitIfBusyPort(port);
});
server.listen(self.options.port, function() { //'listening' listener
server.close();
cb(app);
});
cb(app);
});
}
function exitIfBusyPort(port) {
var server = net.createServer();
server.on('error', function (e) {
if(e.code === 'EADDRINUSE') {
console.log('Address in use ...');
process.exit(-1);
}
});
server.listen(port, function() { //'listening' listener
server.close();
});
}
}

@@ -128,0 +135,0 @@

@@ -85,3 +85,3 @@ /*

npm.load({}, function() {
npm.commands.ls({}, true, function(e, data) {
npm.commands.ls([], true, function(e, data) {
res.writeHead(200, {

@@ -88,0 +88,0 @@ 'Content-Type': 'application/json'

@@ -69,5 +69,2 @@ /*

}
else if(/worker\./.test(filename)) {
mf = fullname;
}
});

@@ -124,3 +121,3 @@ })

this.createWorker = function () {
var worker = cluster.fork();
var worker = cluster.fork().process;
var self = this;

@@ -193,3 +190,7 @@ fs.writeFileSync(this.options.pids + '/worker.' + worker.pid + '.pid', worker.pid);

var deathWatcher = function (worker) {
var deathWatcher = function (worker, code, signal) {
if(code === 0) {
self.stats.noWorkers--;
return;
}
self.emitter.emit('died', worker.pid);

@@ -203,6 +204,6 @@ self.stats.workersKilled++;

};
cluster.on('death', deathWatcher);
cluster.on('exit', deathWatcher);
process.on('SIGINT', function() {
cluster.removeListener('death', deathWatcher);
cluster.removeListener('exit', deathWatcher);
self.emitter.emit('SIGINT');

@@ -217,4 +218,8 @@ });

});
process.exit(0);
var internal = setInterval(function() {
if(self.stats.noWorkers === 0) {
clearInterval(internal);
process.exit(0);
}
}, 100);
});

@@ -309,3 +314,19 @@

clearInterval(recycle);
process.emit('SIGTERM');
if(listening) {
try {
app.close();
}
catch(e) {}
}
self.emitter.emit('SIGTERM', {
pid: process.pid,
type: 'worker'
});
// Once all pending connections are closed, exit.
var internal = setInterval(function() {
if(conns === 0) {
clearInterval(internal);
process.exit(-1);
}
}, 100);
}

@@ -312,0 +333,0 @@ }, 100);

@@ -8,3 +8,3 @@ {

"name": "cluster2",
"version": "0.3.1",
"version": "0.3.2",
"repository": {

@@ -15,3 +15,3 @@ "type": "git",

"engines": {
"node": ">= 0.6.0"
"node": ">= 0.8.0"
},

@@ -21,3 +21,3 @@ "main": "lib/index.js",

"underscore": "",
"express": "2.5.9",
"express": "2.5.11",
"ejs": "",

@@ -27,3 +27,3 @@ "npm": ""

"devDependencies": {
"express": "2.5.9",
"express": "2.5.11",
"nodeunit": "",

@@ -30,0 +30,0 @@ "request": ""

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc