From e1353ef1e4ea6fc9182941ed410cb4e293fcc6e8 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 24 Oct 2026 12:48:24 +0200 Subject: measure document saved-size only after changes --- src/api/document.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/api/document.rs') diff --git a/src/api/document.rs b/src/api/document.rs index 303f5c9..6c10c38 100644 --- a/src/api/document.rs +++ b/src/api/document.rs @@ -22,6 +22,7 @@ pub(crate) async fn get_document(State(state): State) -> Response { let swarm_id = state.swarm_id().await.unwrap_or_default(); let start = Instant::now(); + let version = crate::swarm::stats::document_version(&state); let doc = std::sync::Arc::clone(&state.doc); // Both steps take time proportional to the document: off the async threads, and // the lock only for the copy. @@ -42,7 +43,9 @@ pub(crate) async fn get_document(State(state): State) -> Response { } }; let took = start.elapsed(); - state.stats.saved_size_measured(bytes.len() as u64, took); + state + .stats + .saved_size_measured(bytes.len() as u64, took, version); info!( bytes = bytes.len(), took_ms = took.as_millis() as u64, -- cgit v1.3.1