]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Download updated data even if cache is still available
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 7 Jul 2017 18:42:36 +0000 (19:42 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 7 Jul 2017 18:42:36 +0000 (19:42 +0100)
src/libutil/map.c

index 0019aaa907f38e46cdaead2ab1a31f387fdb2b96..fad48aeab2fe9c7a53d76a0a56d5880553f0c0b6 100644 (file)
@@ -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) {