From: Vsevolod Stakhov Date: Wed, 13 Jun 2018 13:59:21 +0000 (+0100) Subject: [Fix] Fix HTTP maps updates X-Git-Tag: 1.7.6~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=432718d1dcf1c97c2d5cd3381240ecb9c0ac4e3d;p=thirdparty%2Frspamd.git [Fix] Fix HTTP maps updates Issue: #2286 --- diff --git a/src/libutil/map.c b/src/libutil/map.c index 2873b76f61..f666ad98d9 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -344,9 +344,13 @@ rspamd_map_cache_cb (gint fd, short what, gpointer ud) if (cache_cbd->gen != cache_cbd->data->gen) { /* We have another update, so this cache element is obviously expired */ - /* Important: we do not set cache availability to zero here */ + /* + * Important!: we do not set cache availability to zero here, as there + * might be fresh cache + */ + msg_info_map ("cached data is now expired (gen mismatch %L != %L) for %s", + cache_cbd->gen, cache_cbd->data->gen, map->name); MAP_RELEASE (cache_cbd->shm, "rspamd_http_map_cached_cbdata"); - msg_info_map ("cached data is now expired (gen mismatch) for %s", map->name); event_del (&cache_cbd->timeout); g_free (cache_cbd); } @@ -447,6 +451,9 @@ http_map_finish (struct rspamd_http_connection *conn, cbd->periodic->need_modify = TRUE; /* Reset the whole chain */ cbd->periodic->cur_backend = 0; + /* Reset cache, old cached data will be cleaned on timeout */ + g_atomic_int_set (&map->cache->available, 0); + rspamd_map_periodic_callback (-1, EV_TIMEOUT, cbd->periodic); MAP_RELEASE (cbd, "http_callback_data");