From 9478d16620a675f87541316eb9977c2c9fb15a8f Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 26 Nov 2017 21:48:16 +0000 Subject: [PATCH] [Minor] Signal upstream system on taskless Redis errors --- lualib/lua_redis.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 -- 2.39.5