diff options
author | Andrew Lewis <nerf@judo.za.org> | 2017-02-05 17:35:59 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2017-02-05 17:35:59 +0200 |
commit | cd7b03ce91faacf7a9bed081a9254d1134802cb0 (patch) | |
tree | e1bb00564e7c89fce04debbd853593d601bb9181 | |
parent | 20a075cba1b3dee4f3d49ee35b111a3e46cf2368 (diff) | |
download | rspamd-cd7b03ce91faacf7a9bed081a9254d1134802cb0.tar.gz rspamd-cd7b03ce91faacf7a9bed081a9254d1134802cb0.zip |
[Test] Silence warnings
-rw-r--r-- | .luacheckrc | 2 | ||||
-rw-r--r-- | src/plugins/lua/url_redirector.lua | 19 |
2 files changed, 9 insertions, 12 deletions
diff --git a/.luacheckrc b/.luacheckrc index 5daf6620b..1c39f8d07 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 7465eb7aa..7c42a3fe3 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 |