davidtucker/node-shutdown-manager — pull request #2 by msamblanet (2014-02-22 17:02:20+00:00)
Title: Pull Request: Enhancements to node-shutdown-manager

First, thanks for publishing node-shutdown-manager - I was just about to write something nearly identical when I found this.

I made some enhancements to node-shutdown-manager...summary:

1) try/catch when running actions
2) ability to specify 2 tiers of actions so that you can keep some services alive until the first batch is complete (possibly loggers, databases, etc...depending what you are doing) - In theory could be generalized to N layers but I did not carry it to that extreme.
3) Added events so that behavior can be customized in a backwards-compatible manner
4) Added a timeout for the waiting on promises so it does not hang in shutdown
5) Altered exit codes for SIGINT and SIGTERM to be consistent with Node's defaults
6) Updated docs and version #

One thing I did not do - I believe it would make sense for node-shutdown-manager to be a singleton...then libraries could depend on it without spawning secondary copies of the object...something to think about...

- M