From 06dca76de30422a9cfdb45a7879c83b3f91cc1e4 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 7 Nov 2026 00:14:08 +0100 Subject: dashboard: polish remake rings --- src/remake/mod.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/remake/mod.rs') 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, #[serde(skip_serializing_if = "Option::is_none")] pub(crate) switch_in_ms: Option, + /// 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, + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) settle_in_ms: Option, } /// 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(), -- cgit v1.3.1