raft: break out of nested loop when id is found
@@ -1428,6 +1428,7 @@ func (r *raft) restore(s pb.Snapshot) bool {
// code here and there assumes that r.id is in the progress tracker.
found := false
cs := s.Metadata.ConfState
+
for _, set := range [][]uint64{
cs.Voters,
cs.Learners,
@@ -1438,6 +1439,9 @@ func (r *raft) restore(s pb.Snapshot) bool {
break
}
}
+ if found {
+ break
+ }
}
if !found {
r.logger.Warningf(
