mirror of
https://gitee.com/iresty/apisix.git
synced 2024-12-05 05:27:35 +08:00
fix: remove stale checker before adding new one (#3427)
lua-resty-healthcheck remove target according to the `ip, port, hostname` tuple. If the newly added target has the same tuple, it will be removed accidently.
This commit is contained in:
parent
8c7a6887ec
commit
a3c7c4098b
@ -88,6 +88,13 @@ local function create_checker(upstream)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if healthcheck_parent.checker then
|
||||||
|
core.config_util.cancel_clean_handler(healthcheck_parent,
|
||||||
|
healthcheck_parent.checker_idx, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
core.log.info("create new checker: ", tostring(checker))
|
||||||
|
|
||||||
local host = upstream.checks and upstream.checks.active and upstream.checks.active.host
|
local host = upstream.checks and upstream.checks.active and upstream.checks.active.host
|
||||||
local port = upstream.checks and upstream.checks.active and upstream.checks.active.port
|
local port = upstream.checks and upstream.checks.active and upstream.checks.active.port
|
||||||
for _, node in ipairs(upstream.nodes) do
|
for _, node in ipairs(upstream.nodes) do
|
||||||
@ -98,13 +105,6 @@ local function create_checker(upstream)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if healthcheck_parent.checker then
|
|
||||||
core.config_util.cancel_clean_handler(healthcheck_parent,
|
|
||||||
healthcheck_parent.checker_idx, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
core.log.info("create new checker: ", tostring(checker))
|
|
||||||
|
|
||||||
healthcheck_parent.checker = checker
|
healthcheck_parent.checker = checker
|
||||||
healthcheck_parent.checker_upstream = upstream
|
healthcheck_parent.checker_upstream = upstream
|
||||||
healthcheck_parent.checker_idx =
|
healthcheck_parent.checker_idx =
|
||||||
|
@ -156,6 +156,8 @@ qr/(create new checker|try to release checker): table/
|
|||||||
create new checker: table
|
create new checker: table
|
||||||
try to release checker: table
|
try to release checker: table
|
||||||
create new checker: table
|
create new checker: table
|
||||||
|
--- no_error_log
|
||||||
|
all upstream nodes is unhealthy, use default
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user