From: Vsevolod Stakhov Date: Tue, 12 Jan 2021 12:31:33 +0000 (+0000) Subject: [Minor] Remove static settings pool (cfg pool is good enough) X-Git-Tag: 3.0~773 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d9180d3ac0fac6d0aa12cd33117cb7efc731e2a2;p=thirdparty%2Frspamd.git [Minor] Remove static settings pool (cfg pool is good enough) --- diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua index 81b328b523..56a9f5079f 100644 --- a/src/plugins/lua/settings.lua +++ b/src/plugins/lua/settings.lua @@ -31,7 +31,6 @@ local lua_selectors = require "lua_selectors" local lua_settings = require "lua_settings" local ucl = require "ucl" local fun = require "fun" -local rspamd_mempool = require "rspamd_mempool" local redis_params @@ -395,7 +394,7 @@ local function check_settings(task) end -- Process settings based on their priority -local function process_settings_table(tbl, allow_ids, mempool, is_static) +local function process_settings_table(tbl, allow_ids, is_static) local get_priority = function(elt) local pri_tonum = function(p) if p then @@ -923,7 +922,7 @@ local function process_settings_table(tbl, allow_ids, mempool, is_static) local rspamd_expression = require "rspamd_expression" out.expression = rspamd_expression.create(elt.expression, parse_atom, - mempool) + rspamd_config:get_mempool()) out.checks = checks if not out.expression then @@ -1041,7 +1040,6 @@ local function process_settings_table(tbl, allow_ids, mempool, is_static) end -- Parse settings map from the ucl line -local settings_map_pool local function process_settings_map(map_text) local parser = ucl.parser() local res,err @@ -1055,17 +1053,11 @@ local function process_settings_map(map_text) if not res then rspamd_logger.warnx(rspamd_config, 'cannot parse settings map: ' .. err) else - if settings_map_pool then - settings_map_pool:destroy() - end - - settings_map_pool = rspamd_mempool.create() - local obj = parser:get_object() if obj['settings'] then - process_settings_table(obj['settings'], false, settings_map_pool) + process_settings_table(obj['settings'], false, false) else - process_settings_table(obj, false, settings_map_pool) + process_settings_table(obj, false, false) end end @@ -1185,7 +1177,6 @@ if set_section and set_section[1] and type(set_section[1]) == "string" then rspamd_logger.errx(rspamd_config, 'cannot load settings from %1', set_section) end elseif set_section and type(set_section) == "table" then - settings_map_pool = rspamd_mempool.create() -- We need to check this table and register static symbols first -- Postponed settings init is needed to ensure that all symbols have been -- registered BEFORE settings plugin. Otherwise, we can have inconsistent settings expressions @@ -1216,12 +1207,6 @@ elseif set_section and type(set_section) == "table" then end, set_section) ) rspamd_config:add_post_init(function () - process_settings_table(set_section, true, settings_map_pool, true) + process_settings_table(set_section, true, true) end, 100) end - -rspamd_config:add_config_unload(function() - if settings_map_pool then - settings_map_pool:destroy() - end -end)