From e546699511510297b1b32f4be1e8a8a7bf0534f4 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 7 Jul 2017 19:42:36 +0100 Subject: [PATCH] [Minor] Download updated data even if cache is still available --- src/libutil/map.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/libutil/map.c b/src/libutil/map.c index 0019aaa90..fad48aeab 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -1095,13 +1095,19 @@ rspamd_map_common_http_callback (struct rspamd_map *map, return; } - else if (rspamd_map_read_cached (map, bk, periodic, data->host)) { - /* Switch to the next backend */ - periodic->cur_backend ++; - data->last_modified = map->cache->last_modified; - rspamd_map_periodic_callback (-1, EV_TIMEOUT, periodic); + else { + if (map->active_http && + data->last_modified > map->cache->last_modified) { + goto check; + } + else if (rspamd_map_read_cached (map, bk, periodic, data->host)) { + /* Switch to the next backend */ + periodic->cur_backend++; + data->last_modified = map->cache->last_modified; + rspamd_map_periodic_callback (-1, EV_TIMEOUT, periodic); - return; + return; + } } } else if (!map->active_http) { -- 2.39.5