diff options
| author | tv <tv@krebsco.de> | 2026-11-07 00:14:08 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-07 00:14:08 +0100 |
| commit | 06dca76de30422a9cfdb45a7879c83b3f91cc1e4 (patch) | |
| tree | 80ca470bfe3cd458d1c6943f85247d0de488d71f /src/remake | |
| parent | df40d6d2aed2d1a3b5c02a0a2e14c7c234d035ef (diff) | |
dashboard: polish remake rings
Diffstat (limited to 'src/remake')
| -rw-r--r-- | src/remake/mod.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/remake/mod.rs b/src/remake/mod.rs index b16b8a3..67fa77b 100644 --- a/src/remake/mod.rs +++ b/src/remake/mod.rs @@ -94,12 +94,19 @@ pub(crate) struct Current { pub(crate) switch_delay_ms: Option<u64>, #[serde(skip_serializing_if = "Option::is_none")] pub(crate) switch_in_ms: Option<u64>, + /// Proposed: how long votes are collected (`Proposal::settle_ms`), and how much of + /// that is left by this node's clock (ms; 0 once past). + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) settle_ms: Option<u64>, + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) settle_in_ms: Option<u64>, } /// The remakes of `epoch` in `doc`, with their phase at `now` (expiry by `grace`, this /// node's `dormant_after`, for records without their own: `Record::phase`), and for one /// committed, this node's wait to switch (`remake`: when it saw the commit; as -/// `switch::check` waits: the proposal's delay, or a quarter of `grace`). +/// `switch::check` waits: the proposal's delay, or a quarter of `grace`); for one +/// proposed, how long it settles and how much of that is left. #[cfg_attr(not(feature = "dashboard"), allow(dead_code))] pub(crate) fn current( remake: &RemakeState, @@ -120,7 +127,16 @@ pub(crate) fn current( let seen = remake.seen_for(&id)?; Some(delay.saturating_sub(seen.as_millis() as u64)) }); + let settling = phase == records::Phase::Proposed; Current { + settle_ms: settling.then_some(record.proposal.settle_ms), + settle_in_ms: settling.then(|| { + record + .proposal + .settle_until + .as_u64() + .saturating_sub(now.as_u64()) + }), phase, coordinator: record.proposal.coordinator.clone(), voters: record.votes.keys().cloned().collect(), |
