Skip to content

Commit 17b7397

Browse files
committed
apply copilot suggestion
1 parent 30f12a5 commit 17b7397

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

apisix/healthcheck_manager.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ local _M = {
3030
working_pool = {}, -- resource_path -> {version = ver, checker = checker}
3131
waiting_pool = {} -- resource_path -> resource_ver
3232
}
33+
local DELAYED_CLEAR_TIMEOUT = 10
3334
local healthcheck_shdict_name = "upstream-healthcheck"
3435
local is_http = ngx.config.subsystem == "http"
3536
if not is_http then
@@ -245,8 +246,8 @@ function _M.timer_working_pool_check()
245246
for resource_path, item in pairs(working_snapshot) do
246247
--- remove from working pool if resource doesn't exist
247248
local res_conf = fetch_latest_conf(resource_path)
248-
if not res_conf then
249-
item.checker:delayed_clear(10)
249+
if not res_conf or not res_conf.value then
250+
item.checker:delayed_clear(DELAYED_CLEAR_TIMEOUT)
250251
item.checker:stop()
251252
core.log.info("try to release checker: ", tostring(item.checker))
252253
_M.working_pool[resource_path] = nil
@@ -257,7 +258,7 @@ function _M.timer_working_pool_check()
257258
core.log.info("checking working pool for resource: ", resource_path,
258259
" current version: ", current_ver, " item version: ", item.version)
259260
if item.version ~= current_ver then
260-
item.checker:delayed_clear(10)
261+
item.checker:delayed_clear(DELAYED_CLEAR_TIMEOUT)
261262
item.checker:stop()
262263
core.log.info("try to release checker: ", tostring(item.checker))
263264
_M.working_pool[resource_path] = nil

0 commit comments

Comments
 (0)