Skip to main content

election_jitter_ms

Function election_jitter_ms 

Source
pub fn election_jitter_ms(me: NodeId, epoch: u32, base_ms: u64) -> u64
Expand description

Deterministic per-(node, epoch) election-timeout jitter in [0, base_ms).

This is Raft’s randomized backoff, made reproducible for the deterministic sims. Different nodes get different spreads, and so does the same node across re-election epochs. Closely-synchronized voters therefore do not arm their election timers in lockstep and split the vote indefinitely.

Both the pure core and the async engine’s initial timer arm call this function, so production self-staggers without per-node config.