commit f4b7df2f42db725c061049298c494c50e348ecb0
parent 76fc33e66a85a7bc7b30fab5675842d246b679f1
Author: Marcel <mtrnord1@gmail.com>
Date: Sat, 30 May 2020 22:44:09 +0200
Recover from failed initial sync
Took 23 minutes
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/app/matrix/sync.rs b/src/app/matrix/sync.rs
@@ -10,6 +10,7 @@ use crate::app::matrix::types::{MessageWrapper, ImageInfoWrapper};
use crate::app::matrix::Response;
use crate::errors::MatrixError;
use yew::Callback;
+use std::time::Duration;
pub struct Sync {
pub(crate) matrix_client: Client,
@@ -27,8 +28,15 @@ impl Sync {
}
_ => {}
}
+ let settings = match client.clone().sync_token().await {
+ None => {
+ SyncSettings::default().token(client.clone().sync_token().await.unwrap()).timeout(Duration::from_secs(30)).full_state(true)
+ },
+ Some(token) => {
+ SyncSettings::default().token(token).timeout(Duration::from_secs(30)).full_state(true)
+ },
+ };
- let settings = SyncSettings::default().token(client.clone().sync_token().await.unwrap());
client
.clone()
.sync_forever(settings, |response| self.on_sync_response(response))