serby / express-graceful-shutdown

Ensure that during shutdown express returns correctly with a 503
ISC License
20 stars 7 forks source link

Fix NODE_ENV check. When not set, it is undefined, not ''. #1

Closed bengourley closed 9 years ago

bengourley commented 9 years ago

In development (when you don't pass NODE_ENV=something on the command line) it is undefined, but this module is checking for '', meaning that it does the graceful shutdown behaviour even in development.

In this PR I added a failing test which subsequently passed after making the code change.

bengourley commented 9 years ago

Also why does it have an exit code of 1? From little poke around exit codes when triggering shutdown by signals, 0 would be fine…?

bengourley commented 9 years ago

Also moved rewire to devDependencies.

serby commented 9 years ago

Regarding:

https://github.com/serby/express-graceful-shutdown/blob/master/index.js#L25

It is because the shutdown didn't complete as expected and something more drastic was needed.

bengourley commented 9 years ago

Thanks.

I meant this line: https://github.com/serby/express-graceful-shutdown/blob/master/index.js#L18

serby commented 9 years ago

Again that is unexpected in production so I deemed it as such.