fix: Apply client-requested timeout to federated key queries

Also parallelised federation calls in related functions
This commit is contained in:
timedout 2026-01-03 16:05:05 +00:00
parent 6c61b3ec5b
commit bc426e1bfc
No known key found for this signature in database
GPG key ID: 0FA334385D0B689F
7 changed files with 81 additions and 33 deletions

View file

@ -1,3 +1,5 @@
use std::time::Duration;
use axum::extract::State;
use conduwuit::{Error, Result};
use futures::{FutureExt, StreamExt, TryFutureExt};
@ -96,6 +98,7 @@ pub(crate) async fn get_keys_route(
&body.device_keys,
|u| Some(u.server_name()) == body.origin.as_deref(),
services.globals.allow_device_name_federation(),
Duration::from_secs(0),
)
.await?;
@ -124,7 +127,8 @@ pub(crate) async fn claim_keys_route(
));
}
let result = claim_keys_helper(&services, &body.one_time_keys).await?;
let result =
claim_keys_helper(&services, &body.one_time_keys, Duration::from_secs(0)).await?;
Ok(claim_keys::v1::Response { one_time_keys: result.one_time_keys })
}