Fix and clarify comment

This commit is contained in:
Tyler Neely 2022-08-24 16:01:19 +00:00
parent 12c55d5d0b
commit 34c3d94163

View File

@ -463,9 +463,10 @@ class Raft {
std::optional<Role> Cron(Follower &follower) {
const auto now = io_.Now();
const auto time_since_last_append_entries = now - follower.last_received_append_entries_timestamp;
// randomized follower timeout with a range of 100-200ms.
Duration election_timeout = RandomTimeout(100000, 200000);
// randomized follower timeout with a range of 100-150ms.
if (time_since_last_append_entries > election_timeout) {
// become a Candidate if we haven't heard from the Leader after this timeout
return Candidate{};