Browse Source

[Minor] Save symbols cache on reload

tags/1.5.0
Vsevolod Stakhov 7 years ago
parent
commit
55e51977a2
3 changed files with 20 additions and 6 deletions
  1. 13
    6
      src/libserver/symbols_cache.c
  2. 6
    0
      src/libserver/symbols_cache.h
  3. 1
    0
      src/rspamd.c

+ 13
- 6
src/libserver/symbols_cache.c View 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;

+ 6
- 0
src/libserver/symbols_cache.h View 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
*/

+ 1
- 0
src/rspamd.c View 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);

Loading…
Cancel
Save