diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-10 23:27:51 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-10 23:27:51 +0000 |
commit | 8bcc03ac88d6f99058bd1a6660f30cb535cf1515 (patch) | |
tree | bb895b9ce0de1eb9c97ccc7e15038576bab1ff6b /src/libstat/stat_config.c | |
parent | 4b6adeee0f69d97673d9f7ca1699311cf29b50ee (diff) | |
download | rspamd-8bcc03ac88d6f99058bd1a6660f30cb535cf1515.tar.gz rspamd-8bcc03ac88d6f99058bd1a6660f30cb535cf1515.zip |
Fix caches initialization.
Diffstat (limited to 'src/libstat/stat_config.c')
-rw-r--r-- | src/libstat/stat_config.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libstat/stat_config.c b/src/libstat/stat_config.c index d8b980aec..0ae36af1b 100644 --- a/src/libstat/stat_config.c +++ b/src/libstat/stat_config.c @@ -165,9 +165,10 @@ rspamd_stat_init (struct rspamd_config *cfg, struct event_base *ev_base) } } - cl->cache = rspamd_stat_get_cache (cache_name); - g_assert (cl->cache != NULL); - cl->cachecf = cl->cache->init (stat_ctx, cfg, cache_obj); + if (cache_name == NULL) { + /* We assume that learn cache is the same as backend */ + cache_name = clf->backend; + } curst = clf->statfiles; @@ -181,6 +182,12 @@ rspamd_stat_init (struct rspamd_config *cfg, struct event_base *ev_base) msg_debug_config ("added backend %s for symbol %s", bk->name, stf->symbol); + st->cache = rspamd_stat_get_cache (cache_name); + g_assert (st->cache != NULL); + st->cachecf = st->cache->init (stat_ctx, cfg, st, cache_obj); + msg_debug_config ("added cache %s for symbol %s", + st->cache->name, stf->symbol); + if (st->bkcf == NULL) { msg_err_config ("cannot init backend %s for statfile %s", clf->backend, stf->symbol); @@ -363,7 +370,6 @@ rspamd_stat_ctx_register_async (rspamd_stat_async_handler handler, { struct rspamd_stat_async_elt *elt; struct rspamd_stat_ctx *st_ctx; - gdouble jittered_time; st_ctx = rspamd_stat_get_ctx (); g_assert (st_ctx != NULL); |