diff options
| author | tv <tv@krebsco.de> | 2026-10-31 19:53:27 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-31 19:56:13 +0100 |
| commit | c3ddce0106d19fc3d37465f71ce50444871655b6 (patch) | |
| tree | a22b3d350bc4be9157ad4cf574eafee689b997c7 /src/swarm/document_file.rs | |
| parent | dfe0daa99e6e545f647715b73929cc3e244e8e0d (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.rs | 4 |
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; } |
