New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

clusterflock

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clusterflock - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

.travis.yml

10

lib/master.js

@@ -33,9 +33,5 @@ var cluster = require('cluster'),

process.on('SIGINT', function() {
if (isShuttingDown) {
logfmt.log({ evt: 'received SIGINT, ignoring (already shutting down)' });
} else {
logfmt.log({ evt: 'received SIGINT, sending myself SIGTERM' });
process.kill(process.pid, 'SIGTERM');
}
process.once('SIGINT', function() {
logfmt.log({ evt: 'received SIGINT, immediately shutting down' });
process.kill(process.pid, 'SIGINT');
});

@@ -42,0 +38,0 @@

@@ -14,5 +14,5 @@ var http = require('http'),

function setupSignalHandlers() {
process.on('SIGINT', function() {
logfmt.log({ evt: 'received SIGINT, sending myself SIGTERM' });
process.kill(process.pid, 'SIGTERM');
process.once('SIGINT', function() {
logfmt.log({ evt: 'received SIGINT, immediately shutting down' });
process.kill(process.pid, 'SIGINT');
});

@@ -19,0 +19,0 @@

{
"name": "clusterflock",
"version": "0.1.1",
"version": "0.2.0",
"description": "a clustering http server for node",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,2 +0,2 @@

# clusterflock
# clusterflock [![Build Status](https://travis-ci.org/jclem/clusterflock.png)](https://travis-ci.org/jclem/clusterflock)

@@ -3,0 +3,0 @@ ![flocking birds](http://cl.ly/image/0e3E400R1n0U/81938785_7755757d8a_m.jpg)

@@ -68,33 +68,23 @@ require('./spec-helper');

it('traps and logs SIGINT', function() {
it('traps and logs SIGINT once', function() {
master({});
spyOn(logfmt, 'log');
process.emit('SIGINT');
expect(logfmt.log).toHaveBeenCalledWith({ evt: 'received SIGINT, sending myself SIGTERM' });
expect(logfmt.log).toHaveBeenCalledWith({ evt: 'received SIGINT, immediately shutting down' });
});
it('forwards SIGINT to SIGTERM', function() {
it('re-calls SIGINT on SIGINT', function() {
master({});
process.emit('SIGINT');
expect(process.kill).toHaveBeenCalledWith(process.pid, 'SIGTERM');
expect(process.kill).toHaveBeenCalledWith(process.pid, 'SIGINT');
});
it('logs subsequent SIGINT ignores', function() {
it('does not handle subsequent SIGINTs', function() {
master({});
process.emit('SIGINT');
process.emit('SIGQUIT');
spyOn(logfmt, 'log');
process.kill.reset();
process.emit('SIGINT');
expect(logfmt.log).toHaveBeenCalledWith({ evt: 'received SIGINT, ignoring (already shutting down)' });
expect(process.kill).not.toHaveBeenCalledWith(process.pid, 'SIGINT');
});
it('does not forward subsequent SIGINTS', function() {
master({});
process.emit('SIGINT');
process.emit('SIGQUIT');
process.kill.reset()
process.emit('SIGINT');
expect(process.kill.callCount).toEqual(0);
});
it('traps and logs SIGTERM', function() {

@@ -181,3 +171,3 @@ master({});

it('kills each worker on SIGQUIT the timeout', function() {
it('kills each worker on SIGQUIT after the timeout', function() {
var killSpy = jasmine.createSpy();

@@ -192,2 +182,11 @@ cluster.workers = { 1: { kill: killSpy } };

});
it('kills its own process on SIGQUIT after the timeout', function() {
master({ timeout: 10 });
process.emit('SIGQUIT');
waits(10);
runs(function() {
expect(process.kill).toHaveBeenCalled();
});
});
});

@@ -38,13 +38,15 @@ require('./spec-helper');

it('traps and logs SIGINT', function() {
it('traps and logs SIGINT once', function() {
worker(handler, {});
spyOn(logfmt, 'log');
process.emit('SIGINT');
expect(logfmt.log).toHaveBeenCalledWith({ evt: 'received SIGINT, sending myself SIGTERM' });
expect(logfmt.log).toHaveBeenCalledWith({ evt: 'received SIGINT, immediately shutting down' });
});
it('forwards SIGINT to SIGTERM', function() {
it('does not handle subsequent SIGINTs', function() {
worker(handler, {});
process.emit('SIGINT');
expect(process.kill).toHaveBeenCalledWith(process.pid, 'SIGTERM');
process.kill.reset();
process.emit('SIGINT');
expect(process.kill).not.toHaveBeenCalledWith(process.pid, 'SIGINT');
});

@@ -51,0 +53,0 @@

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