aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/document_file.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-31 19:53:27 +0100
committertv <tv@krebsco.de>2026-10-31 19:53:27 +0100
commit9c12bf2e8815dc9b42be62f1e1fd2932dd02938b (patch)
tree09cd985fae9142a247a2285c755f9d002a2c7b30 /src/swarm/document_file.rs
parentf4b0a7c5159d418e22682d2bd7d413fb3587ca7f (diff)
use Automerge as Document instead of AutoCommit
This allows a lot of operations to drop mut.
Diffstat (limited to 'src/swarm/document_file.rs')
-rw-r--r--src/swarm/document_file.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/swarm/document_file.rs b/src/swarm/document_file.rs
index 435ff32..6a516a1 100644
--- a/src/swarm/document_file.rs
+++ b/src/swarm/document_file.rs
@@ -41,13 +41,13 @@ pub(crate) async fn flush(state: &AppState) {
}
Due::Append { epoch, since } => {
let (heads, increment) = {
- let mut replica = state.doc.write().await;
+ let replica = state.doc.read().await;
// Switched since: the next flush rewrites the file instead.
if replica.epoch != epoch {
return;
}
let heads = replica.heads().to_vec();
- (heads, crate::document::save_since(&mut replica.doc, &since))
+ (heads, crate::document::save_since(&replica.doc, &since))
};
file.append(since, heads, increment).await;
}