Skip to content

Commit

Permalink
Merge branch 'release-5.1' into cherry-pick-4347-to-release-5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
disksing authored Nov 30, 2021
2 parents 040b206 + dcfbff7 commit 6f9c086
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ func (c *RaftCluster) Stop() {
}

c.running = false
close(c.quit)
c.coordinator.stop()
close(c.quit)
c.Unlock()
c.wg.Wait()
log.Info("raftcluster is stopped")
Expand Down
6 changes: 6 additions & 0 deletions server/cluster/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,12 @@ func (s *scheduleController) Stop() {

func (s *scheduleController) Schedule() []*operator.Operator {
for i := 0; i < maxScheduleRetries; i++ {
// no need to retry if schedule should stop to speed exit
select {
case <-s.ctx.Done():
return nil
default:
}
// If we have schedule, reset interval to the minimal interval.
if op := s.Scheduler.Schedule(s.cluster); op != nil {
s.nextInterval = s.Scheduler.GetMinInterval()
Expand Down

0 comments on commit 6f9c086

Please sign in to comment.