Skip to content

Commit

Permalink
node: renew follower lease after voting
Browse files Browse the repository at this point in the history
Summary:

Server remains in follower state as long as it receives valid RPCs from a leader or candidate.

details: ehds/braft#3
  • Loading branch information
ehds committed Apr 16, 2024
1 parent 0d58b44 commit 664983f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/braft/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1806,6 +1806,7 @@ void NodeImpl::step_down(const int64_t term, bool wakeup_a_candidate,
_vote_ctx.reset(this);
} else if (_state == STATE_FOLLOWER) {
_pre_vote_ctx.reset(this);
_follower_lease.renew(PeerId());
} else if (_state <= STATE_TRANSFERRING) {
_stepdown_timer.stop();
_ballot_box->clear_pending_tasks();
Expand Down

0 comments on commit 664983f

Please sign in to comment.