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
commita4a8b36459e0f9b82eaaf90a8baaf7c02595cffc (patch)
tree087dd63c7d39469f7f894a6b547474eaf61e9774 /src/sync.rs
parentaa428ce6281af82e578425407ba5739053f72d15 (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) {