From 995cd1c8a7cee964bbe2f9d73bf3dad3ae668d9b Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Tue, 30 Mar 2021 16:09:51 +0300 Subject: [PATCH] raft: use existing function to check if election timeout elapsed is_past_election_timeout() repeats the calculation that election_elapsed() is doing. Use existing function instead. --- raft/fsm.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raft/fsm.hh b/raft/fsm.hh index e7bc12c56f..6f8d3c1054 100644 --- a/raft/fsm.hh +++ b/raft/fsm.hh @@ -224,7 +224,7 @@ private: void maybe_commit(); // Check if the randomized election timeout has expired. bool is_past_election_timeout() const { - return _clock.now() - _last_election_time >= _randomized_election_timeout; + return election_elapsed() >= _randomized_election_timeout; } // A helper to send any kind of RPC message.