aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_redis.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-11-26 21:48:16 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-11-26 21:48:16 +0000
commit9478d16620a675f87541316eb9977c2c9fb15a8f (patch)
tree58a903c58c35f1d7d9b980b66b4a50879cec5ef9 /lualib/lua_redis.lua
parente7073a76bd2543beef76428b4662dbc9ad68ee07 (diff)
downloadrspamd-9478d16620a675f87541316eb9977c2c9fb15a8f.tar.gz
rspamd-9478d16620a675f87541316eb9977c2c9fb15a8f.zip
[Minor] Signal upstream system on taskless Redis errors
Diffstat (limited to 'lualib/lua_redis.lua')
-rw-r--r--lualib/lua_redis.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/lualib/lua_redis.lua b/lualib/lua_redis.lua
index 8dafa023b..bc48f5c0b 100644
--- a/lualib/lua_redis.lua
+++ b/lualib/lua_redis.lua
@@ -519,6 +519,15 @@ local function redis_make_request_taskless(ev_base, cfg, redis_params, key, is_w
end
local addr
+ local function rspamd_redis_make_request_cb(err, data)
+ if err then
+ addr:fail()
+ else
+ addr:ok()
+ end
+ callback(err, data, addr)
+ end
+
local rspamd_redis = require "rspamd_redis"
if key then
@@ -542,7 +551,7 @@ local function redis_make_request_taskless(ev_base, cfg, redis_params, key, is_w
local options = {
ev_base = ev_base,
config = cfg,
- callback = callback,
+ callback = rspamd_redis_make_request_cb,
host = addr:get_addr(),
timeout = redis_params['timeout'],
cmd = command,
@@ -562,6 +571,7 @@ local function redis_make_request_taskless(ev_base, cfg, redis_params, key, is_w
logger.errx('cannot execute redis request')
addr:fail()
end
+
return ret,conn,addr
end