}
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)
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)
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
'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