raft: avoid jump tag to make code more understandable

This commit is contained in:
Xiang Liu 2021-10-24 19:33:22 +08:00
parent c534a78340
commit 020c4f8ca7

View File

@ -372,14 +372,16 @@ func (n *node) run() {
// very sound and likely has bugs. // very sound and likely has bugs.
if _, okAfter := r.prs.Progress[r.id]; okBefore && !okAfter { if _, okAfter := r.prs.Progress[r.id]; okBefore && !okAfter {
var found bool var found bool
outer:
for _, sl := range [][]uint64{cs.Voters, cs.VotersOutgoing} { for _, sl := range [][]uint64{cs.Voters, cs.VotersOutgoing} {
for _, id := range sl { for _, id := range sl {
if id == r.id { if id == r.id {
found = true found = true
break outer break
} }
} }
if found {
break
}
} }
if !found { if !found {
propc = nil propc = nil