diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-24 12:25:03 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-24 12:25:22 +0000 |
commit | 55e51977a231b715c3317dbbbf042ccc7310d63d (patch) | |
tree | 6570404d534bef88f0ae2d0ebf02503920c59dc4 | |
parent | f217ad81ea039a7662a8fa58b9d3d6b8098ff65b (diff) | |
download | rspamd-55e51977a231b715c3317dbbbf042ccc7310d63d.tar.gz rspamd-55e51977a231b715c3317dbbbf042ccc7310d63d.zip |
[Minor] Save symbols cache on reload
-rw-r--r-- | src/libserver/symbols_cache.c | 19 | ||||
-rw-r--r-- | src/libserver/symbols_cache.h | 6 | ||||
-rw-r--r-- | src/rspamd.c | 1 |
3 files changed, 20 insertions, 6 deletions
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c index b2a363500..5fa5be37e 100644 --- a/src/libserver/symbols_cache.c +++ b/src/libserver/symbols_cache.c @@ -826,14 +826,9 @@ rspamd_symbols_cache_add_condition_delayed (struct symbols_cache *cache, return TRUE; } - void -rspamd_symbols_cache_destroy (struct symbols_cache *cache) +rspamd_symbols_cache_save (struct symbols_cache *cache) { - GList *cur; - struct delayed_cache_dependency *ddep; - struct delayed_cache_condition *dcond; - if (cache != NULL) { if (cache->cfg->cache_filename) { @@ -844,6 +839,18 @@ rspamd_symbols_cache_destroy (struct symbols_cache *cache) cache->cfg->cache_filename); } } + } +} + +void +rspamd_symbols_cache_destroy (struct symbols_cache *cache) +{ + GList *cur; + struct delayed_cache_dependency *ddep; + struct delayed_cache_condition *dcond; + + if (cache != NULL) { + rspamd_symbols_cache_save (cache); if (cache->delayed_deps) { cur = cache->delayed_deps; diff --git a/src/libserver/symbols_cache.h b/src/libserver/symbols_cache.h index 6be4de01c..f6015c2ef 100644 --- a/src/libserver/symbols_cache.h +++ b/src/libserver/symbols_cache.h @@ -62,6 +62,12 @@ struct symbols_cache* rspamd_symbols_cache_new (struct rspamd_config *cfg); void rspamd_symbols_cache_destroy (struct symbols_cache *cache); /** + * Saves symbols cache to disk if possible + * @param cache + */ +void rspamd_symbols_cache_save (struct symbols_cache *cache); + +/** * Load symbols cache from file, must be called _after_ init_symbols_cache */ gboolean rspamd_symbols_cache_init (struct symbols_cache* cache); diff --git a/src/rspamd.c b/src/rspamd.c index c00faa056..a7933ff7c 100644 --- a/src/rspamd.c +++ b/src/rspamd.c @@ -273,6 +273,7 @@ reread_config (struct rspamd_main *rspamd_main) struct rspamd_config *tmp_cfg, *old_cfg; gchar *cfg_file; + rspamd_symbols_cache_save (rspamd_main->cfg->cache); tmp_cfg = rspamd_config_new (); g_hash_table_unref (tmp_cfg->c_modules); tmp_cfg->c_modules = g_hash_table_ref (rspamd_main->cfg->c_modules); |