Skip to content

Commit

Permalink
fix: when called checker:get_target_status got err, we should log it~ (
Browse files Browse the repository at this point in the history
…apache#3424)

Co-authored-by: nieyong <[email protected]>
  • Loading branch information
yongboy and nieyong authored Jan 27, 2021
1 parent 2b532f0 commit ea8eef8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apisix/balancer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ local function fetch_health_nodes(upstream, checker)
local port = upstream.checks and upstream.checks.active and upstream.checks.active.port
local up_nodes = core.table.new(0, #nodes)
for _, node in ipairs(nodes) do
local ok = checker:get_target_status(node.host, port or node.port, host)
local ok, err = checker:get_target_status(node.host, port or node.port, host)
if ok then
-- TODO filter with metadata
up_nodes[node.host .. ":" .. node.port] = node.weight
elseif err then
core.log.error("failed to get health check target status, addr: ",
node.host, ":", port or node.port, ", host: ", host, ", err: ", err)
end
end

Expand Down

0 comments on commit ea8eef8

Please sign in to comment.