diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-11-14 18:58:17 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-11-14 18:58:17 +0000 |
commit | 763835888879721961d047ba112c8542a7f558f0 (patch) | |
tree | fadc2f972e56ccd9a78603c7584fa22ca177f6a8 | |
parent | 6c89ca62fecf0ee5d4a5da80785a11dd545edf0d (diff) | |
download | rspamd-763835888879721961d047ba112c8542a7f558f0.tar.gz rspamd-763835888879721961d047ba112c8542a7f558f0.zip |
[Feature] Check cached maps more frequently
-rw-r--r-- | src/libutil/map.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libutil/map.c b/src/libutil/map.c index 5e90886b5..fdaecc3ae 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -1589,6 +1589,15 @@ rspamd_map_watch (struct rspamd_config *cfg, struct event_base *ev_base, map->active_http = active_http; } + if (!map->active_http) { + /* Check cached version more frequently as it is cheap */ + + if (map->poll_timeout >= cfg->map_timeout && + cfg->map_file_watch_multiplier < 1.0) { + map->poll_timeout = map->poll_timeout * cfg->map_file_watch_multiplier; + } + } + rspamd_map_schedule_periodic (map, FALSE, TRUE, FALSE); cur = g_list_next (cur); @@ -2018,7 +2027,8 @@ rspamd_map_add_from_ucl (struct rspamd_config *cfg, if (bk != NULL) { if (bk->protocol == MAP_PROTO_FILE) { - map->poll_timeout = (map->poll_timeout * cfg->map_file_watch_multiplier); + map->poll_timeout = (map->poll_timeout * + cfg->map_file_watch_multiplier); } g_ptr_array_add (map->backends, bk); |