]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Save symbols cache on reload
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 24 Jan 2017 12:25:03 +0000 (12:25 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 24 Jan 2017 12:25:22 +0000 (12:25 +0000)
src/libserver/symbols_cache.c
src/libserver/symbols_cache.h
src/rspamd.c

index b2a36350085c3055a3252b82f79c87597d4d5967..5fa5be37e3ed8343ca962169e78cf0f7e06eaf13 100644 (file)
@@ -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;
index 6be4de01c28ca94746fe0e226af50a45fe6dbcea..f6015c2ef712c8a24c5c600e01885d7b57d78d7f 100644 (file)
@@ -61,6 +61,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
  */
index c00faa056c7a1cdce67740d13b54845a841bb8df..a7933ff7c4b377914e1cfa1aa93f7695ecf67130 100644 (file)
@@ -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);