Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 1 addition & 29 deletions CubeProxy/lua/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,38 +53,10 @@ end
function _M.is_faulty_backend(self, backend_ip, check_remote)
local cache = ngx.shared.faulty_backend
local value = cache:get(backend_ip)
if not value or value ~= "true" then
return false, nil
end

if check_remote == false then
if value == "true" then
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not remove the entire is_faulty_backend() and ngx.shared.faulty_backend?

return true, nil
end

local redis = require "redis_iresty"
local red = redis:new({
redis_ip = ngx.var.redis_ip,
redis_port = ngx.var.redis_port,
redis_pd = ngx.var.redis_pd,
redis_index = ngx.var.redis_index
})
local key = "faulty_backend_set"
local err
value, err = red:smembers(key)
if err then
return false, err
end

if not value then
return false, nil
end

for _, v in ipairs(value) do
if v == backend_ip then
return true, nil
end
end

return false, nil
end

Expand Down
Loading