pudiva chip líquida <[email protected]> wrote:
> Dear unicorns,
> 
> I was trying to register some code with `at_exit`, so that it would
> execute when my app processes terminated, but I found out that it was
> being run only for the main unicorn process, not the workers, as those
> are terminated with `exit!` (note the !):
> 
> https://yhbt.net/unicorn.git/tree/lib/unicorn/http_server.rb?h=v6.0.0#n675
> 
> Would you mind me asking why you decided to go with `exit!` instead of
> plain `exit`, and what would be the correct way of executing code on
> worker termination?

That `exit!' is only temporary during worker init on SIGQUIT.

:QUIT is retrapped and made graceful at the end of init_worker_process:

  https://yhbt.net/unicorn.git/tree/lib/unicorn/http_server.rb?h=v6.0.0#n694

t/t0020-at_exit-handler.sh should be testing SIGQUIT behavior

SIGTERM/SIGINT remain `exit!' since they're specified as immediate
(well, as soon as Ruby sig handlers fire)
--
unsubscribe: one-click, see List-Unsubscribe header
archive: https://yhbt.net/unicorn-public/

Reply via email to