diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-12-30 17:23:51 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-12-30 17:23:51 +0000 |
commit | 77d131d681eb197dad596f7b46a7791c7d77e7df (patch) | |
tree | c9ed9df2f0fbcd0a4907413d62f44863302cfe9a /lualib/lua_settings.lua | |
parent | d3bb11ac4358dc6b96044bcb681112520cf9c272 (diff) | |
download | rspamd-77d131d681eb197dad596f7b46a7791c7d77e7df.tar.gz rspamd-77d131d681eb197dad596f7b46a7791c7d77e7df.zip |
[Fix] Try to fix a mess with settings loading by adding priorities
Diffstat (limited to 'lualib/lua_settings.lua')
-rw-r--r-- | lualib/lua_settings.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lualib/lua_settings.lua b/lualib/lua_settings.lua index e0fc58b9d..bf6826749 100644 --- a/lualib/lua_settings.lua +++ b/lualib/lua_settings.lua @@ -230,7 +230,7 @@ local function transform_settings_maybe(settings, name) return settings end -local function register_settings_id(str, settings) +local function register_settings_id(str, settings, from_postload) local numeric_id = numeric_settings_id(str) if known_ids[numeric_id] then @@ -252,8 +252,10 @@ local function register_settings_id(str, settings) } end - if not post_init_added then - rspamd_config:add_post_init(function () register_settings_cb(true) end) + if not from_postload and not post_init_added then + -- Use high priority to ensure that settings are initialised early but not before all + -- plugins are loaded + rspamd_config:add_post_init(function () register_settings_cb(true) end, 150) rspamd_config:add_config_unload(function() if post_init_added then known_ids = {} @@ -300,4 +302,6 @@ exports.default_symbols = function() return default_symbols end +exports.load_all_settings = register_settings_cb + return exports
\ No newline at end of file |