Socket
Socket
Sign inDemoInstall

express-graceful-exit

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-graceful-exit - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

5

CHANGELOG.md

@@ -0,1 +1,6 @@

0.4.1 / 2018-01-15
==================
* Name anonymous functions for call stack clarity
0.4.0 / 2017-03-19

@@ -2,0 +7,0 @@ ==================

17

lib/graceful-exit.js

@@ -9,3 +9,3 @@

*/
exports.init = function (server) {
exports.init = function init(server) {
server.on('connection', function (socket) {

@@ -20,3 +20,3 @@ sockets.push(socket);

exports.gracefulExitHandler = function(app, server, _options) {
exports.gracefulExitHandler = function gracefulExitHandler(app, server, _options) {
// Get the options set up

@@ -50,2 +50,3 @@ if (!_options) {

options.callback(code);
options.callback = false; // prevent 2nd call
} else {

@@ -57,3 +58,3 @@ logger("Registered callback is not a function");

// leave a bit of time to write logs, callback to complete, etc
setTimeout(function() {
setTimeout(function exitProcess() {
process.exit(1);

@@ -78,3 +79,3 @@ }, options.exitDelay);

logger('All connections closed gracefully');
logger('No longer accepting connections');
exit(0);

@@ -116,3 +117,3 @@

// be graceful, but failed.
suicideTimeout = setTimeout(function() {
suicideTimeout = setTimeout(function suicideHandler() {
if (connectionsClosed) {

@@ -140,5 +141,5 @@ // this condition should never occur, see server.close() above

exports.middleware = function(app) {
exports.middleware = function middleware(app) {
// This flag is used to tell the middleware we create that the server wants
// to stop, so we do not allow anymore connections. This is done for all new
// to stop, so we do not allow any more connections. This is done for all new
// connections for us by Node, but we need to handle the connections that are

@@ -148,3 +149,3 @@ // using the Keep-Alive header to stay on.

return function(req, res, next) {
return function checkGracefulExit(req, res, next) {
// Sorry Keep-Alive connections, but we need to part ways

@@ -151,0 +152,0 @@ if (app.settings.graceful_exit === true) {

{
"name": "express-graceful-exit",
"version": "0.4.0",
"version": "0.4.1",
"description": "Allow graceful exits for express apps, supporting zero downtime deploys",

@@ -5,0 +5,0 @@ "keywords": [

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