diff options
| author | tv <tv@krebsco.de> | 2026-10-24 12:48:24 +0200 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-24 12:48:24 +0200 |
| commit | 7787c7a635262d3c6204ccd1853a344e5a3ed487 (patch) | |
| tree | f84926f8783baa01ec12ac3e0fd29c8003cfd558 /src/api/document.rs | |
| parent | 0c7252e9b5e094b189ac87a23100c13e1febe480 (diff) | |
measure document saved-size only after changes
Diffstat (limited to 'src/api/document.rs')
| -rw-r--r-- | src/api/document.rs | 5 |
1 files changed, 4 insertions, 1 deletions
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<AppState>) -> 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<AppState>) -> 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, |
