aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/changes.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/changes.rs')
-rw-r--r--src/swarm/changes.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/swarm/changes.rs b/src/swarm/changes.rs
index 3a50769..7f3c2e9 100644
--- a/src/swarm/changes.rs
+++ b/src/swarm/changes.rs
@@ -21,9 +21,8 @@ pub(crate) async fn run_change_publisher(state: AppState) {
let before = last_heads.clone();
let doc = Arc::clone(&state.doc);
- // Looking changes up needs the document mutably.
let (heads, paths, conflicts) = tokio::task::spawn_blocking(move || {
- let mut replica = doc.blocking_write();
+ let replica = doc.blocking_read();
let heads = replica.heads().to_vec();
if heads == before {
return (heads, Vec::new(), Vec::new());
@@ -31,13 +30,13 @@ pub(crate) async fn run_change_publisher(state: AppState) {
// After an epoch switch the previous heads belong to the old document:
// report the root as changed, which every stream is related to.
- if !changes::missing(&mut replica.doc, &before).is_empty() {
+ if !changes::missing(&replica.doc, &before).is_empty() {
return (heads, vec![Vec::new()], Vec::new());
}
let mut paths = Vec::new();
let mut conflicts = Vec::new();
- for changed in store::changed(&mut replica.doc, &before, &heads, InLists::Index) {
+ for changed in store::changed(&replica.doc, &before, &heads, InLists::Index) {
if changed.conflict {
conflicts.push(changed.path.clone());
}