Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chuntaojun committed Jun 29, 2024
1 parent 5330d65 commit 09e1549
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
22 changes: 0 additions & 22 deletions plugin/healthchecker/leader/checker_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,28 +482,6 @@ const (
maxCheckCount = 3
)

func (c *LeaderHealthChecker) checkLeaderAlive(ctx context.Context) {
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
peer := c.findLeaderPeer()
if peer == nil {
// 可能是在 Leader 调整中,不处理探测
continue
}

if !peer.IsAlive() {
log.Info("[Health Check][Leader] leader peer not alive, do suspend")
c.Suspend()
}
}
}
}

func (c *LeaderHealthChecker) DebugHandlers() []model.DebugHandler {
return []model.DebugHandler{
{
Expand Down
2 changes: 2 additions & 0 deletions plugin/healthchecker/leader/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ func (p *RemotePeer) checkLeaderAlive(ctx context.Context) {
select {
case <-ctx.Done():
ticker.Stop()
plog.Info("check leader alive job stop", zap.String("host", p.Host()), zap.Uint32("port", p.port))
return
case <-ticker.C:
var errCount int
for i := 0; i < maxCheckCount; i++ {
Expand Down

0 comments on commit 09e1549

Please sign in to comment.