From: Andrew Lewis Date: Fri, 28 Feb 2025 08:09:52 +0000 (+0200) Subject: [Minor] Fix luacheck complaints X-Git-Tag: 3.12.0~54^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c3dbe5779e488ea7d467c9f0c28831b444a1d4c;p=thirdparty%2Frspamd.git [Minor] Fix luacheck complaints --- diff --git a/src/plugins/lua/contextal.lua b/src/plugins/lua/contextal.lua index 341b7a125b..8cc5cf1d05 100644 --- a/src/plugins/lua/contextal.lua +++ b/src/plugins/lua/contextal.lua @@ -33,6 +33,8 @@ local rspamd_logger = require "rspamd_logger" local rspamd_util = require "rspamd_util" local ucl = require "ucl" +local redis_params + local contextal_actions = { 'ALERT', 'ALLOW', @@ -83,12 +85,18 @@ local function process_actions(task, obj, is_cached) return end + local function redis_set_cb(err) + if err then + rspamd_logger.err(task, 'error setting cache: %s', err) + end + end + local key = cache_key(task) local ret = lua_redis.redis_make_request(task, redis_params, -- connect params key, -- hash key true, -- is write - redis_get_cb, --callback + redis_set_cb, --callback 'SET', -- command { key, ucl.to_format(cache_obj, 'json-compact') } -- arguments ) @@ -129,8 +137,8 @@ local function submit(task) return end local parser = ucl.parser() - local _, err = parser:parse_string(body) - if err then + local _, parse_err = parser:parse_string(body) + if parse_err then rspamd_logger.err(task, 'cannot parse JSON: %s', err) return end @@ -218,8 +226,8 @@ local function action_cb(task) return end local parser = ucl.parser() - local _, err = parser:parse_string(body) - if err then + local _, parse_err = parser:parse_string(body) + if parse_err then rspamd_logger.err(task, 'cannot parse JSON: %s', err) return end @@ -245,9 +253,6 @@ local function set_url_path(base, path) return base .. ts .. path end -local opts = rspamd_config:get_all_opt(N) -if not opts then return end - settings = lua_util.override_defaults(settings, opts) contextal_actions = lua_util.list_to_hash(contextal_actions)