From: Andrew Lewis Date: Sun, 5 Feb 2017 15:35:59 +0000 (+0200) Subject: [Test] Silence warnings X-Git-Tag: 1.5.0~179^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1399%2Fhead;p=thirdparty%2Frspamd.git [Test] Silence warnings --- diff --git a/.luacheckrc b/.luacheckrc index 5daf6620be..1c39f8d07a 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -26,7 +26,7 @@ globals = { } ignore = { - 'W212', -- unused argument + '212', -- unused argument } files['/**/src/plugins/lua/spamassassin.lua'].globals = { diff --git a/src/plugins/lua/url_redirector.lua b/src/plugins/lua/url_redirector.lua index 7465eb7aa2..7c42a3fe37 100644 --- a/src/plugins/lua/url_redirector.lua +++ b/src/plugins/lua/url_redirector.lua @@ -25,9 +25,7 @@ local settings = { } local rspamd_logger = require "rspamd_logger" -local rspamd_util = require "rspamd_util" local rspamd_http = require "rspamd_http" -local fun = require "fun" local hash = require "rspamd_cryptobox_hash" local function cache_url(task, orig_url, url, key, param) @@ -103,11 +101,7 @@ local function url_redirector_handler(task, url, param) local function redis_get_cb(err, data) if not err then if type(data) == 'string' then - if data == 'processing' then - -- We have already requested this url to be resolved, so just return - -- the original url - - else + if data ~= 'processing' then -- Got cached result rspamd_logger.infox(task, 'found cached redirect from %s to %s', url, data) @@ -116,10 +110,10 @@ local function url_redirector_handler(task, url, param) end end end - local function redis_reserve_cb(err, data) - if err then - rspamd_logger.errx(task, 'got error while setting redirect keys: %s', err) - elseif data == 1 then + local function redis_reserve_cb(nerr, ndata) + if nerr then + rspamd_logger.errx(task, 'got error while setting redirect keys: %s', nerr) + elseif ndata == 1 then resolve_url(task, url_str, url_str, key, param, 1) end end @@ -132,6 +126,9 @@ local function url_redirector_handler(task, url, param) 'SETNX', -- command {key, 'processing'} -- arguments ) + if not ret then + rspamd_logger.errx(task, 'Couldnt schedule SETNX') + end end local ret = rspamd_redis_make_request(task, redis_params, -- connect params