file: resty/healthcheck.lua
function: incr_counter
description:
The bug code is there:
if (health_mode == “healthy” and target.healthy) or
(health_mode == “unhealthy” and not target.healthy) then
– No need to count successes when healthy or failures when unhealthy
return true
end
When I config passive healthcheck without active healthcheck. If the failures counter of a target is not null and it’s current status is heathy, then this bug results that the success request can’t clean the failure counter。
I had resove this bug in this way:
local nokCounter = self.shm:get(get_shm_key(self.TARGET_NOKS, ip, port));
if (health_mode == “healthy” and target.healthy and (not nokCounter or nokCounter == 0)) or
(health_mode == “unhealthy” and not target.healthy) then
– No need to count successes when healthy or failures when unhealthy
return true
end