commit 273390c: [Minor] Fix broken init logic
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Apr 6 15:49:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-04-06 16:46:02 +0100
URL: https://github.com/rspamd/rspamd/commit/273390cf62b08ebf1261694444a92b156dc9661a (HEAD -> master)
[Minor] Fix broken init logic
---
src/libserver/rspamd_symcache.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/libserver/rspamd_symcache.c b/src/libserver/rspamd_symcache.c
index aeab2de10..5c72a714d 100644
--- a/src/libserver/rspamd_symcache.c
+++ b/src/libserver/rspamd_symcache.c
@@ -1396,24 +1396,25 @@ rspamd_symcache_metric_connect_cb (gpointer k, gpointer v, gpointer ud)
gboolean
rspamd_symcache_init (struct rspamd_symcache *cache)
{
- gboolean res;
+ gboolean res = TRUE;
g_assert (cache != NULL);
cache->reload_time = cache->cfg->cache_reload_time;
- /* Just in-memory cache */
- if (cache->cfg->cache_filename == NULL) {
- rspamd_symcache_post_init (cache);
- return TRUE;
+ if (cache->cfg->cache_filename != NULL) {
+ res = rspamd_symcache_load_items (cache, cache->cfg->cache_filename);
+ }
+
+ if (!res) {
+ return res;
}
- /* Copy saved cache entries */
- res = rspamd_symcache_load_items (cache, cache->cfg->cache_filename);
rspamd_symcache_post_init (cache);
+
/* Connect metric symbols with symcache symbols */
if (cache->cfg->symbols) {
- g_hash_table_foreach(cache->cfg->symbols,
+ g_hash_table_foreach (cache->cfg->symbols,
rspamd_symcache_metric_connect_cb,
cache);
}
More information about the Commits
mailing list