bugsnag / bugsnag-agent

A forwarding agent for BugSnag to guarantee minimal reporting impact.
MIT License
14 stars 9 forks source link

Terminate on SIGTERM #9

Closed aleemb closed 6 years ago

aleemb commented 8 years ago

If the process is running via supervisord or similar it needs to be able to terminate via SIGTERM

amiri27 commented 8 years ago

Any chance to merge this?

kattrali commented 8 years ago

Thanks for the pull request @aleemb. While this does solve your immediate problem, I'd rather handle SIGTERM properly and gracefully exit, while SIGQUIT and SIGKILL will immediately exit. SIGTERM should finish handling any incoming requests and ensure all outgoing requests have finished before finally exiting (perhaps with a timeout to eventually exit if the current requests do not finish in time). This will ensure that any pending errors are not lost, unless the agent is explicitly killed via SIGQUIT.

This will match the behaviour of other popular daemons such as gunicorn, nginx, unicorn and even Heroku.