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.
This commit is contained in:
Gleb Natapov
2021-03-30 16:09:51 +03:00
parent f186de909d
commit 995cd1c8a7

View File

@@ -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.