Skip to content

Commit

Permalink
bump to 0.5.0 release candidate 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ivolucien committed Oct 18, 2019
1 parent 2885b84 commit 5191259
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.5.0-rc.2 / 2019-10-18
=======================
Thank you hhunt for additional testing and the fix PR

* Fix errors in new option to handle a last request, including a crasher

0.5.0-rc.1 / 2019-10-15
=======================
Thank you hhunt for finding this bug, as well as for the fix PR and test code
Expand Down
12 changes: 7 additions & 5 deletions lib/graceful-exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ exports.gracefulExitHandler = function gracefulExitHandler (app, server, _option

exports.handleFinalRequests = function handleFinalRequests (req, res, next) {
var headers = inspect(req.headers) || '?'; // safe object to string
var connection = req.connection || {};

if (options.performLastRequest && req.connection.lastRequestStarted === false) {
if (options.performLastRequest && connection.lastRequestStarted === false) {
logger('Server exiting, performing last request for this connection. Headers: ' + headers);

req.connection.lastRequestStarted = true;
connection.lastRequestStarted = true;
return next();
}

Expand All @@ -177,13 +178,14 @@ exports.middleware = function middleware (app) {
app.set('graceful_exit', false);

return function checkIfExitingGracefully (req, res, next) {
var connection = req.connection || {};

if (app.settings.graceful_exit === false) {
connection.lastRequestStarted = connection.lastRequestStarted || false;
next();
return next();
}

var connection = req.connection || {};
connection.lastRequestStarted = connection.lastRequestStarted || false;

// Set connection closing header for response, if any. Fix to issue 14, thank you HH
res.set('Connection', 'close');

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "express-graceful-exit",
"version": "0.5.0-rc.1",
"version": "0.5.0-rc.2",
"description": "Allow graceful exits for express apps, supporting zero downtime deploys",
"keywords": [
"express",
Expand Down

0 comments on commit 5191259

Please sign in to comment.