Skip to content

Commit

Permalink
schedule: fix panic issue after delete the rule (#2513) (#2515)
Browse files Browse the repository at this point in the history
Signed-off-by: nolouch <nolouch@gmail.com>
  • Loading branch information
sre-bot authored Jun 5, 2020
1 parent e88c246 commit 30f0b01
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/schedule/placement/fit.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ func (f *RegionFit) GetRuleFit(peerID uint64) *RuleFit {
// It returns 1 when the first fit result is better.
func CompareRegionFit(a, b *RegionFit) int {
for i := range a.RuleFits {
if i >= len(b.RuleFits) {
break
}
if cmp := compareRuleFit(a.RuleFits[i], b.RuleFits[i]); cmp != 0 {
return cmp
}
Expand Down

0 comments on commit 30f0b01

Please sign in to comment.