From 59c1511bcacedddc354e82033d523f459c6db5d4 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 24 Oct 2026 20:28:36 +0200 Subject: cache heads To reduce the number of write locks, heads are now cached. --- src/api/stats.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/api/stats.rs') 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(); -- cgit v1.3.1