From 159786fe369246c43cde80da081fc3b4d577bd84 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Thu, 10 Aug 2023 17:31:14 +0200 Subject: [PATCH] feat(notification client): bump sliding sync timeouts (#2403) The timeouts were a bit too agressive, according to some user logs, resulting in failing to load the event mentioned in the notification. Here's the rationale for the new timeouts: we're only limited by the iOS process which has *at most* 30 seconds to process a notification. - We're running at most 3 requests of the notification sliding sync, so that will be (1+3)*3 = 12 seconds allocated for that. - If we've found an event but it required decryption, we're running the encryption sync up to 2 times, (3+4) seconds each => 14 seconds. At most we're eating up 26 seconds of the entire time, leaving some ballast for the rest of the program. --- crates/matrix-sdk-ui/src/notification_client.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/matrix-sdk-ui/src/notification_client.rs b/crates/matrix-sdk-ui/src/notification_client.rs index d0abaece1..bf1dde7dd 100644 --- a/crates/matrix-sdk-ui/src/notification_client.rs +++ b/crates/matrix-sdk-ui/src/notification_client.rs @@ -153,7 +153,7 @@ impl NotificationClient { let encryption_sync = EncryptionSync::new( Self::LOCK_ID.to_owned(), self.client.clone(), - Some((Duration::from_secs(3), Duration::from_secs(1))), + Some((Duration::from_secs(3), Duration::from_secs(4))), with_locking, ) .await; @@ -268,7 +268,7 @@ impl NotificationClient { .client .sliding_sync(Self::CONNECTION_ID)? .poll_timeout(Duration::from_secs(1)) - .network_timeout(Duration::from_secs(1)) + .network_timeout(Duration::from_secs(3)) .with_account_data_extension( assign!(AccountDataConfig::default(), { enabled: Some(true) }), )