MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / reset_election_timeout

Method reset_election_timeout

nodedb-raft/src/node/internal.rs:370–376  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

368 }
369
370 pub(super) fn reset_election_timeout(&mut self) {
371 let mut rng = rand::rng();
372 let min = self.config.election_timeout_min.as_millis() as u64;
373 let max = self.config.election_timeout_max.as_millis() as u64;
374 let timeout = Duration::from_millis(rng.random_range(min..=max));
375 self.election_deadline = Instant::now() + timeout;
376 }
377}

Callers 6

start_electionMethod · 0.80
become_followerMethod · 0.80
restoreMethod · 0.80
handle_request_voteMethod · 0.80
handle_append_entriesMethod · 0.80

Calls 2

nowFunction · 0.85
as_millisMethod · 0.45

Tested by

no test coverage detected