From 8b648d0d3f1e6bb4f9299ddaaa5502b1b5815718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20K=C3=B6sters?= Date: Wed, 22 Feb 2023 22:09:15 +0100 Subject: [PATCH] fix: force abort federation requests after 2 minutes --- src/service/sending/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/service/sending/mod.rs b/src/service/sending/mod.rs index 1861feb4..e0e2f549 100644 --- a/src/service/sending/mod.rs +++ b/src/service/sending/mod.rs @@ -684,7 +684,15 @@ impl Service { T: Debug, { let permit = self.maximum_requests.acquire().await; - let response = server_server::send_request(destination, request).await; + let response = tokio::time::timeout( + Duration::from_secs(2 * 60), + server_server::send_request(destination, request), + ) + .await + .map_err(|_| { + warn!("Timeout waiting for server response of {destination}"); + Error::BadServerResponse("Timeout waiting for server response") + })?; drop(permit); response