add builder struct for sending::send_federation_request

This will allow us to add optional parameters for things like error
logging and timeouts without cluttering call sites that use the
default.
This commit is contained in:
Olivia Lee 2024-08-23 19:54:04 -07:00
parent 5bc3fce257
commit 10d361e347
No known key found for this signature in database
GPG key ID: 54D568A15B9CD1F9
2 changed files with 91 additions and 54 deletions

View file

@ -1,5 +1,6 @@
use std::{
collections::{BTreeMap, HashMap, HashSet},
future::IntoFuture,
time::Duration,
};
@ -398,12 +399,15 @@ pub(crate) async fn get_keys_helper<F: Fn(&UserId) -> bool>(
server,
tokio::time::timeout(
Duration::from_secs(25),
services().sending.send_federation_request(
server,
federation::keys::get_keys::v1::Request {
device_keys: device_keys_input_fed,
},
),
services()
.sending
.send_federation_request(
server,
federation::keys::get_keys::v1::Request {
device_keys: device_keys_input_fed,
},
)
.into_future(),
)
.await
.map_err(|_e| Error::BadServerResponse("Query took too long"))