Skip to content
Snippets Groups Projects
Commit 7f6c19f0 authored by Jason Volk's avatar Jason Volk Committed by 🥺
Browse files

fix using same federation reqwest pool after sender deduplication.


Signed-off-by: default avatarJason Volk <jason@zemos.net>
parent ca1c77d7
No related branches found
No related tags found
No related merge requests found
......@@ -234,7 +234,8 @@ pub async fn send_federation_request<T>(&self, dest: &ServerName, request: T) ->
{
let permit = self.maximum_requests.acquire().await;
let timeout = Duration::from_secs(self.timeout);
let response = tokio::time::timeout(timeout, send::send_request(dest, request))
let client = &services().globals.client.federation;
let response = tokio::time::timeout(timeout, send::send_request(client, dest, request))
.await
.map_err(|_| {
warn!("Timeout after 300 seconds waiting for server response of {dest}");
......@@ -781,8 +782,9 @@ async fn handle_events_kind_normal(
}
let permit = services().sending.maximum_requests.acquire().await;
let client = &services().globals.client.sender;
let response = send::send_request(
client,
dest,
send_transaction_message::v1::Request {
origin: services().globals.server_name().to_owned(),
......
......@@ -44,7 +44,9 @@ pub enum FedDest {
}
#[tracing::instrument(skip_all, name = "send")]
pub(crate) async fn send_request<T>(destination: &ServerName, request: T) -> Result<T::IncomingResponse>
pub(crate) async fn send_request<T>(
client: &reqwest::Client, destination: &ServerName, request: T,
) -> Result<T::IncomingResponse>
where
T: OutgoingRequest + Debug,
{
......@@ -202,12 +204,7 @@ pub(crate) async fn send_request<T>(destination: &ServerName, request: T) -> Res
}
debug!("Sending request to {destination} at {url}");
let response = services()
.globals
.client
.federation
.execute(reqwest_request)
.await;
let response = client.execute(reqwest_request).await;
debug!("Received response from {destination} at {url}");
match response {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment