nginx timer in log module

洪志道 hongzhidao at gmail.com
Sat Sep 17 00:25:54 UTC 2016


Hi

As the following codes.


buffer->event->handler = ngx_http_log_flush_handler;


static void
ngx_http_log_flush_handler(ngx_event_t *ev)
{
    ...
    if (ev->timedout) {
        ngx_http_log_flush(ev->data, ev->log);
        return;
    }
    ...
}


static void
ngx_http_log_flush(ngx_open_file_t *file, ngx_log_t *log)
{
    ...
    if (buffer->event && buffer->event->timer_set) {
        ngx_del_timer(buffer->event);
    }
}


I find there are two functions explicitly call event handler.
1. ngx_event_cancel_timers happened as long as worker process quits.
2. ngx_event_expire_timers in ngx_process_events_and_timers.

And they remove timer from timer rbtree, then set timer_set zero.
After that they call event->handler.

So why we call ngx_del_timer in ngx_http_log_flush again?

Thanks.

B.R~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20160917/4d7ae7b0/attachment.html>


More information about the nginx-devel mailing list