fix: Correct federation timeouts

This commit is contained in:
Jade Ellis 2026-01-06 01:52:25 +00:00
parent 344d68dabc
commit 74db426c6b
No known key found for this signature in database
GPG key ID: 8705A2A3EBF77BD2
3 changed files with 14 additions and 5 deletions

View file

@ -340,7 +340,9 @@
# this to be high to account for extremely large room joins, slow
# homeservers, your own resources etc.
#
#federation_timeout = 300
# Joins have 6x the timeout.
#
#federation_timeout = 60
# MSC4284 Policy server request timeout (seconds). Generally policy
# servers should respond near instantly, however may slow down under

View file

@ -435,7 +435,9 @@ pub struct Config {
/// this to be high to account for extremely large room joins, slow
/// homeservers, your own resources etc.
///
/// default: 300
/// Joins have 6x the timeout.
///
/// default: 60
#[serde(default = "default_federation_timeout")]
pub federation_timeout: u64,
@ -2474,7 +2476,7 @@ fn default_well_known_timeout() -> u64 { 10 }
fn default_federation_conn_timeout() -> u64 { 10 }
fn default_federation_timeout() -> u64 { 25 }
fn default_federation_timeout() -> u64 { 60 }
fn default_policy_server_request_timeout() -> u64 { 10 }

View file

@ -82,8 +82,13 @@ impl crate::Service for Service {
synapse: base(config)?
.dns_resolver(resolver.resolver.hooked.clone())
.connect_timeout(Duration::from_secs(config.federation_conn_timeout))
.read_timeout(Duration::from_secs(305))
.timeout(Duration::from_secs(120))
.read_timeout(Duration::from_secs(config.federation_timeout.saturating_mul(6)))
.timeout(Duration::from_secs(
config
.federation_timeout
.saturating_mul(6)
.saturating_add(config.federation_conn_timeout),
))
.pool_max_idle_per_host(0)
.redirect(redirect::Policy::limited(3))
.build()?,