Skip to content

Commit

Permalink
enhancement: close the underlying connections every time the heartbea…
Browse files Browse the repository at this point in the history
…t fails (openyurtio#397)
  • Loading branch information
rambohe-ch authored Jul 28, 2021
1 parent a514d91 commit 0c0fa0c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/yurthub/healthchecker/health_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ func (c *checker) check() bool {
}

klog.Infof("failed to update lease: %v, remote server %s", err, c.remoteServer.String())
if c.onFailureFunc != nil {
c.onFailureFunc(c.remoteServer.Host)
}
c.healthyCnt = 0
if c.isHealthy() {
c.setHealthy(false)
now := time.Now()
klog.Infof("cluster becomes unhealthy from %v, healthy status lasts %v, remote server: %v", time.Now(), now.Sub(c.lastTime), c.remoteServer.String())
c.lastTime = now
if c.onFailureFunc != nil {
c.onFailureFunc(c.remoteServer.Host)
}
metrics.Metrics.ObserveServerHealthy(c.remoteServer.Host, 0)
}
return false
Expand Down

0 comments on commit 0c0fa0c

Please sign in to comment.