From f1e8223f058c8ba9873caaaf412a44b6da68c9ff Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 14 Apr 2022 20:59:31 +0100 Subject: [PATCH] [Minor] Fix more lua issues --- src/plugins/lua/dynamic_conf.lua | 4 ++-- src/plugins/lua/forged_recipients.lua | 2 +- src/plugins/lua/fuzzy_collect.lua | 4 ++-- src/plugins/lua/neural.lua | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/lua/dynamic_conf.lua b/src/plugins/lua/dynamic_conf.lua index 833aa45df..8a2f95acc 100644 --- a/src/plugins/lua/dynamic_conf.lua +++ b/src/plugins/lua/dynamic_conf.lua @@ -249,8 +249,8 @@ if section then rspamd_config:add_on_load(function(_, ev_base, worker) if worker:is_scanner() then rspamd_config:add_periodic(ev_base, 0.0, - function(cfg, _ev_base) - check_dynamic_conf(cfg, _ev_base) + function(cfg, _) + check_dynamic_conf(cfg, ev_base) return settings.redis_watch_interval end, true) end diff --git a/src/plugins/lua/forged_recipients.lua b/src/plugins/lua/forged_recipients.lua index f3667ea07..a0fcd09ec 100644 --- a/src/plugins/lua/forged_recipients.lua +++ b/src/plugins/lua/forged_recipients.lua @@ -141,7 +141,7 @@ local function check_forged_headers(task) if smtp_from and smtp_from[1] and smtp_from[1]['addr'] ~= '' then local mime_from = task:get_from(2) if not mime_from or not mime_from[1] or - not (string.lower(mime_from[1]['addr']) == string.lower(smtp_from[1]['addr'])) then + (string.lower(mime_from[1]['addr']) ~= string.lower(smtp_from[1]['addr'])) then task:insert_result(symbol_sender, 1, ((mime_from or E)[1] or E).addr or '', smtp_from[1].addr) end end diff --git a/src/plugins/lua/fuzzy_collect.lua b/src/plugins/lua/fuzzy_collect.lua index 9a63823d9..d64830c6b 100644 --- a/src/plugins/lua/fuzzy_collect.lua +++ b/src/plugins/lua/fuzzy_collect.lua @@ -180,8 +180,8 @@ if opts and type(opts) == 'table' then rspamd_config:add_on_load(function(_, ev_base, worker) if worker:is_primary_controller() then rspamd_config:add_periodic(ev_base, 0.0, - function(_cfg, _ev_base) - return collect_fuzzy_hashes(_cfg, _ev_base) + function(cfg, _) + return collect_fuzzy_hashes(cfg, ev_base) end) end end) diff --git a/src/plugins/lua/neural.lua b/src/plugins/lua/neural.lua index 7b414b5a3..5389f5ab2 100644 --- a/src/plugins/lua/neural.lua +++ b/src/plugins/lua/neural.lua @@ -243,10 +243,10 @@ local function ann_push_task_result(rule, task, verdict, score, set) local str = rspamd_util.zstd_compress(table.concat(vec, ';')) local target_key = set.ann.redis_key .. '_' .. learn_type .. '_set' - local function learn_vec_cb(_err) - if _err then + local function learn_vec_cb(redis_err) + if redis_err then rspamd_logger.errx(task, 'cannot store train vector for %s:%s: %s', - rule.prefix, set.name, _err) + rule.prefix, set.name, redis_err) else lua_util.debugm(N, task, "add train data for ANN rule " .. -- 2.39.5