atagen

matrix-rust-sdk

public
Star0
Watch0

Commit 7873e6c41daf

tarball

atagen <boss@atagen.co>2026-10-26 02:52 UTC

1 file changed+7-1
sync-service: back off the offline probe

wait_to_be_online relied on the request's retry config, which the wasm transport ignores and which never retries a 4xx such as a dead token, so a device build asked for /versions every ~105ms (248 times in 43s).
Modified file: crates/matrix-sdk-ui/src/sync_service.rs+7 additions−1 deletions
@@ -186,6 +186,9 @@ impl SyncTaskSupervisor {
186186 };
187187
188188 let wait_to_be_online = async move {
189+ // the wasm transport ignores `RequestConfig`, and a 4xx such as a dead token is never
190+ // retried, so without growing the pause this asks for /versions every 100ms
191+ let mut pause = Duration::from_millis(100);
189192 loop {
190193 // Encountering network failures when sending a request which has with no retry
191194 // limit set in the `RequestConfig` are treated as permanent failures and our
@@ -203,7 +206,10 @@ impl SyncTaskSupervisor {
203206 // case.
204207 match client.fetch_server_versions(Some(request_config)).await {
205208 Ok(_) => break,
206- Err(_) => sleep(Duration::from_millis(100)).await,
209+ Err(_) => {
210+ sleep(pause).await;
211+ pause = (pause * 2).min(Duration::from_secs(10));
212+ }
207213 }
208214 }
209215 };