From: Vsevolod Stakhov Date: Fri, 7 Jul 2017 18:42:36 +0000 (+0100) Subject: [Minor] Download updated data even if cache is still available X-Git-Tag: 1.6.2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e546699511510297b1b32f4be1e8a8a7bf0534f4;p=rspamd.git [Minor] Download updated data even if cache is still available --- 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) {