summaryrefslogtreecommitdiffstats
path: root/src/api/stats.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-24 20:28:36 +0200
committertv <tv@krebsco.de>2026-10-24 20:28:36 +0200
commit111444d956e98d348244326d3bf6c34da62b96d7 (patch)
treeb0f54e27ce0b4d8e4074a2ba44715dfa5afc1313 /src/api/stats.rs
parent7cc4d0f3ae697e6429b6d237fd477297b21add94 (diff)
cache heads
To reduce the number of write locks, heads are now cached.
Diffstat (limited to 'src/api/stats.rs')
-rw-r--r--src/api/stats.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/api/stats.rs b/src/api/stats.rs
index bc925ff..838cc0f 100644
--- a/src/api/stats.rs
+++ b/src/api/stats.rs
@@ -134,8 +134,8 @@ async fn collect(state: &AppState) -> StatsResponse {
let node = state.stats.snapshot();
let (heads, tier) = {
- let mut replica = state.doc.write().await;
- let heads = replica.doc.get_heads().len();
+ let replica = state.doc.read().await;
+ let heads = replica.heads().len();
(heads, members::tier(&replica.doc, state.local_id()))
};
let saved = state.stats.saved_size();