Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(healthcheck) record last_run when healthcheck is scheduled rather than completed #72

Merged
Merged
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
3 changes: 2 additions & 1 deletion lib/resty/healthcheck.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,6 @@ local function checker_callback(self, health_mode)
expire = function()
self:log(DEBUG, "checking ", health_mode, " targets: #", #list_to_check)
self:active_check_targets(list_to_check)
self.checks.active[health_mode].last_run = ngx_now()
end,
})
if timer == nil then
Expand Down Expand Up @@ -1479,13 +1478,15 @@ function _M.new(opts)
(checker_obj.checks.active.healthy.last_run +
checker_obj.checks.active.healthy.interval <= cur_time)
then
checker_obj.checks.active.healthy.last_run = cur_time
checker_callback(checker_obj, "healthy")
end

if checker_obj.checks.active.unhealthy.active and
(checker_obj.checks.active.unhealthy.last_run +
checker_obj.checks.active.unhealthy.interval <= cur_time)
then
checker_obj.checks.active.unhealthy.last_run = cur_time
checker_callback(checker_obj, "unhealthy")
end
end
Expand Down