Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <admin@liudos.us>
  • Loading branch information
lhy1024 committed Dec 18, 2024
1 parent 8ada003 commit 120fe68
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/region_syncer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,13 @@ func (s *RegionSyncer) StartSyncWithLeader(addr string) {
}
}
log.Error("server failed to establish sync stream with leader", zap.String("server", s.server.Name()), zap.String("leader", s.server.GetLeader().GetName()), errs.ZapError(err))
timer := time.NewTimer(retryInterval)
select {
case <-ctx.Done():
log.Info("stop synchronizing with leader due to context canceled")
return
case <-time.After(retryInterval):
case <-timer.C:
timer.Stop()
}
continue
}
Expand All @@ -181,11 +183,13 @@ func (s *RegionSyncer) StartSyncWithLeader(addr string) {
if err = stream.CloseSend(); err != nil {
log.Error("failed to terminate client stream", errs.ZapError(errs.ErrGRPCCloseSend, err))
}
timer := time.NewTimer(retryInterval)
select {
case <-ctx.Done():
log.Info("stop synchronizing with leader due to context canceled")
return
case <-time.After(retryInterval):
case <-timer.C:
timer.Stop()
}
break
}
Expand Down

0 comments on commit 120fe68

Please sign in to comment.