Skip to content

Commit 466aa73

Browse files
committed
Remove unnecessary term handling
No need to set term if granting vote since receiving a request with a higher or lower term is handled earlier in this method. Signed-off-by: reubenninan <[email protected]>
1 parent 14a0612 commit 466aa73

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

server/raft.go

-6
Original file line numberDiff line numberDiff line change
@@ -4079,15 +4079,9 @@ func (n *raft) processVoteRequest(vr *voteRequest) error {
40794079
voteOk := n.vote == noVote || n.vote == vr.candidate
40804080
if voteOk && (vr.lastTerm > n.pterm || vr.lastTerm == n.pterm && vr.lastIndex >= n.pindex) {
40814081
vresp.granted = true
4082-
n.term = vr.term
40834082
n.vote = vr.candidate
40844083
n.writeTermVote()
40854084
n.resetElectionTimeout()
4086-
} else {
4087-
if vr.term >= n.term && n.vote == noVote {
4088-
n.term = vr.term
4089-
n.resetElect(randCampaignTimeout())
4090-
}
40914085
}
40924086

40934087
// Term might have changed, make sure response has the most current

0 commit comments

Comments
 (0)