summaryrefslogtreecommitdiffstats
path: root/lualib/lua_redis.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-12 13:12:06 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-12 13:12:06 +0000
commit329704079122e929867fc4a9e32ff3e10a64182b (patch)
tree0dbe0988d74ffa4a630e45d4471a23fe9bdb1f48 /lualib/lua_redis.lua
parent61e347959b684ac1682f09940080355586c106f5 (diff)
downloadrspamd-329704079122e929867fc4a9e32ff3e10a64182b.tar.gz
rspamd-329704079122e929867fc4a9e32ff3e10a64182b.zip
[Minor] Fix reporting of fatal errors in redis scripts
Diffstat (limited to 'lualib/lua_redis.lua')
-rw-r--r--lualib/lua_redis.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/lualib/lua_redis.lua b/lualib/lua_redis.lua
index 79ea64651..ee015fef2 100644
--- a/lualib/lua_redis.lua
+++ b/lualib/lua_redis.lua
@@ -750,6 +750,7 @@ local function load_script_task(script, task)
logger.errx(task, 'cannot upload script to %s: %s',
opt.upstream:get_addr(), err)
opt.upstream:fail()
+ script.fatal_error = err
else
opt.upstream:ok()
logger.infox(task,
@@ -791,6 +792,7 @@ local function load_script_taskless(script, cfg, ev_base)
logger.errx(cfg, 'cannot upload script to %s: %s',
opt.upstream:get_addr(), err)
opt.upstream:fail()
+ script.fatal_error = err
else
opt.upstream:ok()
logger.infox(cfg,
@@ -853,7 +855,14 @@ local function exec_redis_script(id, params, callback, keys, args)
return false
end
+
local script = redis_scripts[id]
+
+ if script.fatal_error then
+ callback(script.fatal_error, nil)
+ return true
+ end
+
if not script.redis_params then
callback('no redis servers defined', nil)
return true