From 70beae3b936ee445659e471f40e59ffaa1e1a3d7 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 18:07:07 +0100 Subject: move all automerge references to document --- src/api/document.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/api/document.rs') diff --git a/src/api/document.rs b/src/api/document.rs index 20bbc7b..08fd21f 100644 --- a/src/api/document.rs +++ b/src/api/document.rs @@ -50,12 +50,11 @@ pub(crate) async fn get_document(State(state): State) -> Response { // Both steps take time proportional to the document: off the async threads, and // the lock only for the copy. let saved = tokio::task::spawn_blocking(move || { - let (mut copy, epoch) = { + let (mut copy, epoch, heads) = { let replica = doc.blocking_read(); - (replica.doc.clone(), replica.epoch) + (replica.doc.clone(), replica.epoch, replica.heads().to_vec()) }; - let heads = copy.get_heads(); - (copy.save(), heads, epoch) + (crate::document::save(&mut copy), heads, epoch) }) .await; let (bytes, heads, epoch) = match saved { -- cgit v1.3.1