fix: force abort federation requests after 2 minutes

This commit is contained in:
Timo Kösters 2023-02-22 22:09:15 +01:00
parent 4617ee2b6b
commit 8b648d0d3f
No known key found for this signature in database
GPG Key ID: 0B25E636FBA7E4CB
1 changed files with 9 additions and 1 deletions

View File

@ -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