From 2c8d691d7c7dc91396657ffb017471c80085ac8c Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 1 Jul 2016 11:53:42 +0100 Subject: [PATCH] [Fix] Fix scheduling of locked map events --- src/libutil/map.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libutil/map.c b/src/libutil/map.c index a29939f26..354ac722e 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -599,9 +599,8 @@ rspamd_map_periodic_dtor (struct map_periodic_cbdata *periodic) /* Not modified */ } - rspamd_map_schedule_periodic (periodic->map, FALSE, FALSE, FALSE); - if (periodic->locked) { + rspamd_map_schedule_periodic (periodic->map, FALSE, FALSE, FALSE); g_atomic_int_set (periodic->map->locked, 0); } @@ -627,7 +626,7 @@ rspamd_map_schedule_periodic (struct rspamd_map *map, timeout = map->poll_timeout * error_mult; } else if (locked) { - timeout = map->poll_timeout * lock_mult; + timeout = lock_mult; } cbd = g_slice_alloc0 (sizeof (*cbd)); @@ -638,8 +637,6 @@ rspamd_map_schedule_periodic (struct rspamd_map *map, cbd->map = map; REF_INIT_RETAIN (cbd, rspamd_map_periodic_dtor); - msg_debug_map ("schedule new periodic event %p in %.2f seconds", cbd, timeout); - if (initial) { evtimer_set (&map->ev, rspamd_map_periodic_callback, cbd); event_base_set (map->ev_base, &map->ev); @@ -647,9 +644,11 @@ rspamd_map_schedule_periodic (struct rspamd_map *map, else { evtimer_del (&map->ev); evtimer_set (&map->ev, rspamd_map_periodic_callback, cbd); + event_base_set (map->ev_base, &map->ev); } jittered_sec = rspamd_time_jitter (timeout, 0); + msg_debug_map ("schedule new periodic event %p in %.2f seconds", cbd, jittered_sec); double_to_tv (jittered_sec, &map->tv); evtimer_add (&map->ev, &map->tv); -- 2.39.5