From c1653a2ac480bac397a535b0783996511abacb7d Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 04:11:45 +0100 Subject: compute per-peer totals in /admin/stats once --- src/api/dashboard/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/api/dashboard/mod.rs') diff --git a/src/api/dashboard/mod.rs b/src/api/dashboard/mod.rs index ad907ed..0a15570 100644 --- a/src/api/dashboard/mod.rs +++ b/src/api/dashboard/mod.rs @@ -257,8 +257,10 @@ impl Graph { /// The snapshot: the node, its figures, its peers, and the map. async fn build(state: &AppState, graph: &Graph) -> JsonValue { - let stats = serde_json::to_value(super::stats::collect(state).await).unwrap_or_default(); - let peers = serde_json::to_value(super::peers::peer_list(state).await).unwrap_or_default(); + // The peers once, for their list and the figures' totals over them. + let list = super::peers::peer_list(state).await; + let stats = serde_json::to_value(super::stats::collect(state, &list).await).unwrap_or_default(); + let peers = serde_json::to_value(&list).unwrap_or_default(); let aliases = { let replica = state.doc.read().await; members::aliases(&replica.doc) -- cgit v1.3.1