diff --git a/crates/matrix-sdk/CHANGELOG.md b/crates/matrix-sdk/CHANGELOG.md index aa9ce0cd5..5d8e38346 100644 --- a/crates/matrix-sdk/CHANGELOG.md +++ b/crates/matrix-sdk/CHANGELOG.md @@ -31,6 +31,13 @@ All notable changes to this project will be documented in this file. - [**breaking**] The MSRV has been bumped to Rust 1.88. ([#5431](https://github.com/matrix-org/matrix-rust-sdk/pull/5431)) +### Bugfix + +- All HTTP requests now have a default `read_timeout` of 60s, which means they'll disconnect if the connection stalls. + `RequestConfig::timeout` is now optional and can be disabled on a per-request basis. This will be done for + the requests used to download media, so they don't get cancelled after the default 30s timeout for no good reason. + ([#5437](https://github.com/matrix-org/matrix-rust-sdk/pull/5437)) + ## [0.13.0] - 2025-07-10 ### Security Fixes diff --git a/crates/matrix-sdk/src/client/mod.rs b/crates/matrix-sdk/src/client/mod.rs index c1c5b448a..e9a81164b 100644 --- a/crates/matrix-sdk/src/client/mod.rs +++ b/crates/matrix-sdk/src/client/mod.rs @@ -20,6 +20,7 @@ use std::{ future::{ready, Future}, pin::Pin, sync::{Arc, Mutex as StdMutex, RwLock as StdRwLock, Weak}, + time::Duration, }; use caches::ClientCaches; @@ -2312,7 +2313,8 @@ impl Client { }); let mut request_config = self.request_config(); if let Some(timeout) = sync_settings.timeout { - request_config.timeout = Some(timeout); + let base_timeout = request_config.timeout.unwrap_or(Duration::from_secs(30)); + request_config.timeout = Some(base_timeout + timeout); } let response = self.send(request).with_request_config(request_config).await?;