Skip to content

Commit

Permalink
fix(healthcheck) remove event watcher when stopping hc (#74)
Browse files Browse the repository at this point in the history
Co-authored-by: Brian Fox <brianhfox@gmail.com>

Co-authored-by: Brian Fox <brianhfox@gmail.com>
  • Loading branch information
locao and onematchfox authored Jun 28, 2021
1 parent 6cbefe0 commit 1edc9b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/resty/healthcheck.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 1edc9b1

Please sign in to comment.