summaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-31 12:30:49 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-31 12:30:49 +0000
commita35e93dc39223107941a5b31ed6d0191e27777b4 (patch)
tree4d14aecd84a418f16b7ce0e8e9b5c998ecb4c039 /src/libutil
parent62fb0aeba5648ab32d4669ed9b9960f3304b6656 (diff)
downloadrspamd-a35e93dc39223107941a5b31ed6d0191e27777b4.tar.gz
rspamd-a35e93dc39223107941a5b31ed6d0191e27777b4.zip
[Fix] Another try to fix slow callbacks and timers
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/libev_helper.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libutil/libev_helper.c b/src/libutil/libev_helper.c
index 65a53d3f7..41195bfa6 100644
--- a/src/libutil/libev_helper.c
+++ b/src/libutil/libev_helper.c
@@ -70,6 +70,9 @@ rspamd_ev_watcher_start (struct ev_loop *loop,
ev_io_start (EV_A_ &ev->io);
if (timeout > 0) {
+ /* Update timestamp to avoid timers running early */
+ ev_now_update (loop);
+
ev->timeout = timeout;
ev_timer_set (&ev->tm, timeout, 0.0);
ev_timer_start (EV_A_ &ev->tm);
@@ -109,6 +112,9 @@ rspamd_ev_watcher_reschedule (struct ev_loop *loop,
if (ev->timeout > 0) {
if (!(ev_can_stop (&ev->tm))) {
+ /* Update timestamp to avoid timers running early */
+ ev_now_update (loop);
+
ev->tm.data = ev;
ev_timer_init (&ev->tm, rspamd_ev_watcher_timer_cb, ev->timeout, 0.0);
ev_timer_start (EV_A_ &ev->tm);