]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Signal upstream system on taskless Redis errors
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 26 Nov 2017 21:48:16 +0000 (21:48 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 26 Nov 2017 21:48:16 +0000 (21:48 +0000)
lualib/lua_redis.lua

index 8dafa023ba41dc53cfb0a0f22aa6c552c0d57c55..bc48f5c0b95af5d209d3f15c8fa4e658b8b40598 100644 (file)
@@ -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