add federation client for select high-timeout requests

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-10-14 03:58:25 +00:00 committed by strawberry
parent c0939c3e9a
commit b4ec1e9d3c
5 changed files with 23 additions and 5 deletions

View file

@ -245,6 +245,7 @@ impl Service {
.await
}
/// Sends a request to a federation server
#[tracing::instrument(skip_all, name = "request")]
pub async fn send_federation_request<T>(&self, dest: &ServerName, request: T) -> Result<T::IncomingResponse>
where
@ -254,6 +255,16 @@ impl Service {
self.send(client, dest, request).await
}
/// Like send_federation_request() but with a very large timeout
#[tracing::instrument(skip_all, name = "synapse")]
pub async fn send_synapse_request<T>(&self, dest: &ServerName, request: T) -> Result<T::IncomingResponse>
where
T: OutgoingRequest + Debug + Send,
{
let client = &self.services.client.synapse;
self.send(client, dest, request).await
}
/// Sends a request to an appservice
///
/// Only returns None if there is no url specified in the appservice