File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 18
18
Dovecot generally doesn't have very important short timeouts, so to avoid
19
19
logging many warnings about this, use a rather high value. */
20
20
#define IOLOOP_TIME_MOVED_FORWARDS_MIN_USECS (100000)
21
+ /* When the ioloop wait time is large, the "time moved forwards" detection
22
+ can't be done as reliably. Apparently if we ask the kernel to wait for
23
+ 10000ms, it might think it's okay to stop after 10100ms or more. So use
24
+ a larger value for larger timeouts. */
25
+ #define IOLOOP_TIME_MOVED_FORWARDS_MIN_USECS_LARGE (1000000)
21
26
22
27
time_t ioloop_time = 0 ;
23
28
struct timeval ioloop_timeval ;
@@ -654,9 +659,13 @@ static void io_loop_handle_timeouts_real(struct ioloop *ioloop)
654
659
/* the callback may have slept, so check the time again. */
655
660
i_gettimeofday (& ioloop_timeval );
656
661
} else {
662
+ int max_diff = diff_usecs < IOLOOP_TIME_MOVED_FORWARDS_MIN_USECS_LARGE ?
663
+ IOLOOP_TIME_MOVED_FORWARDS_MIN_USECS :
664
+ IOLOOP_TIME_MOVED_FORWARDS_MIN_USECS_LARGE ;
665
+
657
666
diff_usecs = timeval_diff_usecs (& ioloop -> next_max_time ,
658
667
& ioloop_timeval );
659
- if (unlikely (- diff_usecs >= IOLOOP_TIME_MOVED_FORWARDS_MIN_USECS )) {
668
+ if (unlikely (- diff_usecs >= max_diff )) {
660
669
io_loops_timeouts_update (- diff_usecs );
661
670
/* time moved forward */
662
671
ioloop -> time_moved_callback (& ioloop -> next_max_time ,
You can’t perform that action at this time.
0 commit comments