From e855d9ed648b23d21bf700dde0e5fc12f85f1a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Moreno?= Date: Fri, 19 Oct 2018 13:33:58 +0200 Subject: [PATCH] sync: None since in the initial sync We can read this in the spec [1]: > To read events, the intended flow of operation is for clients to first > call the /sync API without a since parameter. This returns the most > recent message events for each room, as well as the state of the room at > the start of the returned timeline [1] https://matrix.org/docs/spec/client_server/latest.html#syncing --- fractal-gtk/src/appop/sync.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fractal-gtk/src/appop/sync.rs b/fractal-gtk/src/appop/sync.rs index a755e8c9..fa7f6bcf 100644 --- a/fractal-gtk/src/appop/sync.rs +++ b/fractal-gtk/src/appop/sync.rs @@ -18,7 +18,12 @@ impl AppOp { pub fn sync(&mut self, initial: bool) { if !self.syncing && self.logged_in { self.syncing = true; - self.backend.send(BKCommand::Sync(self.since.clone(), initial)).unwrap(); + // for the initial sync we set the since to None to avoid long syncing + // the since can be a very old value and following the spec we should + // do the initial sync without a since: + // https://matrix.org/docs/spec/client_server/latest.html#syncing + let since = match initial { true => None, _ => self.since.clone() }; + self.backend.send(BKCommand::Sync(since, initial)).unwrap(); } }