aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-01 11:53:42 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-01 11:56:07 +0100
commit2c8d691d7c7dc91396657ffb017471c80085ac8c (patch)
tree6be64091aa5cbfb04ce65601302545846aacd457
parent27fe6a37294da7c156390dce377abfcb62224cde (diff)
downloadrspamd-2c8d691d7c7dc91396657ffb017471c80085ac8c.tar.gz
rspamd-2c8d691d7c7dc91396657ffb017471c80085ac8c.zip
[Fix] Fix scheduling of locked map events
-rw-r--r--src/libutil/map.c9
1 files 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);