diff options
Diffstat (limited to 'src/state/mod.rs')
| -rw-r--r-- | src/state/mod.rs | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/state/mod.rs b/src/state/mod.rs index efa4953..cf64dc3 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -413,7 +413,7 @@ impl AppState { .expect("document write task panicked") } - /// Mutates the document on the blocking pool as one Automerge change, then + /// Mutates the document on the blocking pool as one change, then /// publishes it. Write and notification run in the same blocking task, so a /// cancelled request can't leave a committed write unannounced. pub(crate) async fn mutate_doc<T, E>( @@ -431,19 +431,10 @@ impl AppState { let mut replica = state.doc.blocking_write(); let result = f(&mut replica.doc); match &result { - // One API write = one Automerge change. - Ok(_) => { - // Stamped with our clock (milliseconds), so receivers can tell - // how long the change took to reach them (`swarm::stats`). - replica.doc.commit_with( - automerge::transaction::CommitOptions::default() - .with_time(state.clock.now_millis().as_u64() as i64), - ); - } + // One API write = one change. + Ok(_) => replica.commit(state.clock.now_millis()), // Discard partial ops (e.g. old value deleted, new one not written). - Err(_) => { - replica.doc.rollback(); - } + Err(_) => replica.rollback(), } replica.refresh_heads(); result |
