commit 8feff3e: [Minor] Skip broken slaves retrieved from sentinel

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Dec 27 18:28:03 UTC 2018


Author: Vsevolod Stakhov
Date: 2018-12-05 14:33:48 +0000
URL: https://github.com/rspamd/rspamd/commit/8feff3e587c05658f5c9ccab3decb12208decc71

[Minor] Skip broken slaves retrieved from sentinel
Issue: #2667

---
 lualib/lua_redis.lua | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lualib/lua_redis.lua b/lualib/lua_redis.lua
index 0c6520e5c..658e26242 100644
--- a/lualib/lua_redis.lua
+++ b/lualib/lua_redis.lua
@@ -137,9 +137,11 @@ local function redis_query_sentinel(ev_base, params, initialised)
       )
 
       for _,slave in ipairs(master.slaves) do
-        read_servers_tbl[#read_servers_tbl + 1] = string.format(
-            '%s:%s', slave.ip, slave.port
-        )
+        if slave['master-link-status'] == 'ok' then
+          read_servers_tbl[#read_servers_tbl + 1] = string.format(
+              '%s:%s', slave.ip, slave.port
+          )
+        end
       end
     end
 


More information about the Commits mailing list