Skip to content

Commit

Permalink
improve the lease
Browse files Browse the repository at this point in the history
Signed-off-by: 1797818494 <[email protected]>
  • Loading branch information
1797818494 committed Feb 3, 2024
1 parent 2f10997 commit dce1422
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ func (r *raft) Step(m pb.Message) error {
case m.Term > r.Term:
if m.Type == pb.MsgVote || m.Type == pb.MsgPreVote {
force := bytes.Equal(m.Context, []byte(campaignTransfer))
inLease := r.checkQuorum && r.lead != None && r.electionElapsed < r.electionTimeout
inLease := r.checkQuorum && r.lead != None && r.electionElapsed < r.electionTimeout && r.Lead != m.From
if !force && inLease {
// If a server receives a RequestVote request within the minimum election timeout
// of hearing from a current leader, it does not update its term or grant its vote
Expand Down

0 comments on commit dce1422

Please sign in to comment.