stop timers and close connections on Nginx reload

Maxim Dounin mdounin at mdounin.ru
Mon Aug 19 11:15:38 UTC 2013


Hello!

On Sat, Aug 17, 2013 at 02:26:14PM -0300, Wandenberg Peixoto wrote:

> is there a way to, inside a module, be notified when the Nginx process
> received a signal to reload?
> I need to stop some timers and do cleanup routines when a worker is on
> "worker process is shutting down" state to allow it to completely stop as
> fast as possible.
> 
> I don't want to start a periodic timer to check this, if there is another
> way.

If connection's c->idle flag is set, it's read event handler will be 
called on shutdown with c->close set to 1.  This might not be very 
convenient if your timers aren't connection-related though.

-- 
Maxim Dounin
http://nginx.org/en/donation.html



More information about the nginx-devel mailing list