diff --git a/lib/resty/healthcheck.lua b/lib/resty/healthcheck.lua index 31c9fdf1..b115ca30 100644 --- a/lib/resty/healthcheck.lua +++ b/lib/resty/healthcheck.lua @@ -1141,6 +1141,7 @@ end function checker:stop() self.checks.active.healthy.active = false self.checks.active.unhealthy.active = false + worker_events.unregister(self.ev_callback, self.EVENT_SOURCE) self:log(DEBUG, "healthchecker stopped") return true end @@ -1441,7 +1442,6 @@ function _M.new(opts) -- just a wrapper to be able to access `self` as a closure return self:event_handler(event, data.ip, data.port, data.hostname) end - worker_events.register_weak(self.ev_callback, self.EVENT_SOURCE) -- handle events to sync up in case there was a change by another worker worker_events:poll()