Hello!
On Tue, May 10, 2016 at 5:14 AM, Mathew Heard wrote:
> When nginx exits and a timer is scheduled, the timer is called with
> premature = true
>
> Is it possible to manipulate or rely on this as a shutdown detection? Has
> anyone implemented a worker shutdown/reload hook?
>
Maybe one can rely on the following facts to detect different kinds of events:
1. Data in shdict survive HUP reload but not restart.
2. ngx.timer's handler's premature argument can be used as a indicator
of the current worker's (proper) shutdown. So can
ngx.worker.exiting().
3. init_by_lua* runs upon HUP reload or server (re)start only.
4. The relationshiop of ngx.worker.id() and ngx.worker.pid() may also
be helpful.
Regards,
-agentzh