remove redundant timers
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
b01d25277d
commit
00ce43d739
2 changed files with 14 additions and 30 deletions
|
@ -17,7 +17,7 @@ use ruma::{
|
|||
DeviceKeyAlgorithm, OwnedDeviceId, OwnedUserId, UserId,
|
||||
};
|
||||
use serde_json::json;
|
||||
use tracing::{debug, error};
|
||||
use tracing::debug;
|
||||
|
||||
use super::SESSION_ID_LENGTH;
|
||||
use crate::{services, utils, Error, Result, Ruma};
|
||||
|
@ -368,23 +368,16 @@ pub(crate) async fn get_keys_helper<F: Fn(&UserId) -> bool>(
|
|||
for (user_id, keys) in vec {
|
||||
device_keys_input_fed.insert(user_id.to_owned(), keys.clone());
|
||||
}
|
||||
(
|
||||
server,
|
||||
tokio::time::timeout(
|
||||
Duration::from_secs(90),
|
||||
services().sending.send_federation_request(
|
||||
server,
|
||||
federation::keys::get_keys::v1::Request {
|
||||
|
||||
let request = federation::keys::get_keys::v1::Request {
|
||||
device_keys: device_keys_input_fed,
|
||||
},
|
||||
),
|
||||
)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("get_keys_helper query took too long: {e}");
|
||||
Error::BadServerResponse("get_keys_helper query took too long")
|
||||
}),
|
||||
)
|
||||
};
|
||||
let response = services()
|
||||
.sending
|
||||
.send_federation_request(server, request)
|
||||
.await;
|
||||
|
||||
(server, Ok(response))
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
@ -408,7 +401,7 @@ pub(crate) async fn get_keys_helper<F: Fn(&UserId) -> bool>(
|
|||
false, /* Dont notify. A notification would trigger another key request resulting in an
|
||||
* endless loop */
|
||||
)?;
|
||||
master_keys.insert(user, raw);
|
||||
master_keys.insert(user.clone(), raw);
|
||||
}
|
||||
|
||||
self_signing_keys.extend(response.self_signing_keys);
|
||||
|
|
|
@ -44,7 +44,6 @@ pub(crate) struct Service {
|
|||
receiver: Mutex<loole::Receiver<Msg>>,
|
||||
startup_netburst: bool,
|
||||
startup_netburst_keep: i64,
|
||||
timeout: u64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
|
@ -95,7 +94,6 @@ impl Service {
|
|||
maximum_requests: Arc::new(Semaphore::new(config.max_concurrent_requests as usize)),
|
||||
startup_netburst: config.startup_netburst,
|
||||
startup_netburst_keep: config.startup_netburst_keep,
|
||||
timeout: config.sender_timeout,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -246,17 +244,10 @@ impl Service {
|
|||
where
|
||||
T: OutgoingRequest + Debug,
|
||||
{
|
||||
let permit = self.maximum_requests.acquire().await;
|
||||
let timeout = Duration::from_secs(self.timeout);
|
||||
let client = &services().globals.client.federation;
|
||||
let response = tokio::time::timeout(timeout, send::send(client, dest, request))
|
||||
.await
|
||||
.map_err(|_| {
|
||||
warn!("Timeout after 300 seconds waiting for server response of {dest}");
|
||||
Error::BadServerResponse("Timeout after 300 seconds waiting for server response")
|
||||
})?;
|
||||
let permit = self.maximum_requests.acquire().await;
|
||||
let response = send::send(client, dest, request).await;
|
||||
drop(permit);
|
||||
|
||||
response
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue