Mercurial > hg > nginx
comparison src/stream/ngx_stream_log_module.c @ 6927:c36d160cd4e0
Access log: removed dead ev->timedout check in flush timer handler.
The ev->timedout flag is set on first timer expiration, and never reset
after it. Due to this the code to stop the timer when the timer was
canceled never worked (except in a very specific time frame immediately
after start), and the timer was always armed again. This essentially
resulted in a buffer flush at the end of an event loop iteration.
This behaviour actually seems to be better than just stopping the flush
timer for the whole shutdown, so it is preserved as is instead of fixing
the code to actually remove the timer. It will be further improved by
upcoming changes to preserve cancelable timers if there are other timers
blocking shutdown.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 07 Mar 2017 18:51:12 +0300 |
parents | 0cf4e82e7c48 |
children | 3fb9b5eb75c0 |
comparison
equal
deleted
inserted
replaced
6926:e662cbf1b932 | 6927:c36d160cd4e0 |
---|---|
639 | 639 |
640 | 640 |
641 static void | 641 static void |
642 ngx_stream_log_flush_handler(ngx_event_t *ev) | 642 ngx_stream_log_flush_handler(ngx_event_t *ev) |
643 { | 643 { |
644 ngx_open_file_t *file; | |
645 ngx_stream_log_buf_t *buffer; | |
646 | |
647 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, ev->log, 0, | 644 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
648 "stream log buffer flush handler"); | 645 "stream log buffer flush handler"); |
649 | 646 |
650 if (ev->timedout) { | 647 ngx_stream_log_flush(ev->data, ev->log); |
651 ngx_stream_log_flush(ev->data, ev->log); | |
652 return; | |
653 } | |
654 | |
655 /* cancel the flush timer for graceful shutdown */ | |
656 | |
657 file = ev->data; | |
658 buffer = file->data; | |
659 | |
660 buffer->event = NULL; | |
661 } | 648 } |
662 | 649 |
663 | 650 |
664 static u_char * | 651 static u_char * |
665 ngx_stream_log_copy_short(ngx_stream_session_t *s, u_char *buf, | 652 ngx_stream_log_copy_short(ngx_stream_session_t *s, u_char *buf, |