summaryrefslogtreecommitdiffstats
path: root/src/sync.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-20 00:51:39 +0200
committertv <tv@krebsco.de>2026-10-20 00:51:39 +0200
commita30499ffedb76dc08ba7e9c9b2ed4eb3f921a5df (patch)
treeb783cd8dac2d73c768586a08356248acfeb32c3b /src/sync.rs
parentae34ebb3b70d529e93ea423f50b46a4ade15259b (diff)
add epoch switch
Diffstat (limited to 'src/sync.rs')
-rw-r--r--src/sync.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sync.rs b/src/sync.rs
index d9f629e..07ed1a0 100644
--- a/src/sync.rs
+++ b/src/sync.rs
@@ -458,6 +458,12 @@ pub(crate) async fn run_change_publisher(state: AppState) {
return (heads, Vec::new(), Vec::new());
}
+ // After an epoch switch the previous heads belong to the old document:
+ // report the root as changed, which every stream is related to.
+ if !before.iter().all(|h| doc.get_change_by_hash(h).is_some()) {
+ return (heads, vec![Vec::new()], Vec::new());
+ }
+
let mut paths = Vec::new();
let mut conflicts = Vec::new();
for patch in doc.diff(&before, &heads) {