Unitech/pm2 — pull request #502 by nmrugg (2014-06-04 18:21:27+00:00)
Title: Always send message event on gracefulReload

The graceful reload depends on a script triggering the `listening` event. See issues #391 for more details.

These changes do three things.

First, instead of forcing a worker process to disconnect if it does not trigger the `listening` event, it will instead start the graceful reload after a timeout.

Second, a script that does not need to listen to anything can alternatively call `process.send('online')` which will trigger the graceful reload.

Third, it there is some error and the process disconnects early, it will catch the error instead of throwing.

This fixes #391.

If you like these changes, I can add documentation to the readme and some tests.