From 6acbf5e15876c3fda98a79d38f7cfe4bea0663fe Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 23 Nov 2016 13:00:36 +0000 Subject: [PATCH] [Fix] Do not load tld file to speed up rspamadm --- src/libserver/cfg_file.h | 3 ++- src/libserver/cfg_utils.c | 7 ++++++- src/rspamadm/rspamadm.c | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h index 1f31d372e..ea75622f8 100644 --- a/src/libserver/cfg_file.h +++ b/src/libserver/cfg_file.h @@ -478,7 +478,8 @@ enum rspamd_post_load_options { RSPAMD_CONFIG_INIT_URL = 1 << 0, RSPAMD_CONFIG_INIT_LIBS = 1 << 1, RSPAMD_CONFIG_INIT_SYMCACHE = 1 << 2, - RSPAMD_CONFIG_INIT_VALIDATE = 1 << 3 + RSPAMD_CONFIG_INIT_VALIDATE = 1 << 3, + RSPAMD_CONFIG_INIT_NO_TLD = 1 << 4 }; #define RSPAMD_CONFIG_LOAD_ALL (RSPAMD_CONFIG_INIT_URL|RSPAMD_CONFIG_INIT_LIBS|RSPAMD_CONFIG_INIT_SYMCACHE|RSPAMD_CONFIG_INIT_VALIDATE) diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 3ec553592..46b574ac8 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -729,7 +729,12 @@ rspamd_config_post_load (struct rspamd_config *cfg, } } - rspamd_url_init (cfg->tld_file); + if (opts & RSPAMD_CONFIG_INIT_NO_TLD) { + rspamd_url_init (NULL); + } + else { + rspamd_url_init (cfg->tld_file); + } } init_dynamic_config (cfg); diff --git a/src/rspamadm/rspamadm.c b/src/rspamadm/rspamadm.c index 6e5541b32..de1e53143 100644 --- a/src/rspamadm/rspamadm.c +++ b/src/rspamadm/rspamadm.c @@ -285,7 +285,8 @@ main (gint argc, gchar **argv, gchar **env) (void) rspamd_log_open (rspamd_main->logger); g_log_set_default_handler (rspamd_glib_log_function, rspamd_main->logger); g_set_printerr_handler (rspamd_glib_printerr_function); - rspamd_config_post_load (cfg, RSPAMD_CONFIG_INIT_LIBS|RSPAMD_CONFIG_INIT_URL); + rspamd_config_post_load (cfg, + RSPAMD_CONFIG_INIT_LIBS|RSPAMD_CONFIG_INIT_URL|RSPAMD_CONFIG_INIT_NO_TLD); /* Setup logger */ if (verbose) { -- 2.39.5