revert: remove dependency on async_recursion

This commit is contained in:
Matthias Ahouansou 2024-03-05 19:58:39 +00:00
parent becaad677f
commit c58af8485d
No known key found for this signature in database
3 changed files with 159 additions and 169 deletions

12
Cargo.lock generated
View file

@ -80,17 +80,6 @@ version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f093eed78becd229346bf859eec0aa4dd7ddde0757287b2b4107a1f09c80002"
[[package]]
name = "async-recursion"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.48",
]
[[package]]
name = "async-trait"
version = "0.1.77"
@ -385,7 +374,6 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
name = "conduit"
version = "0.7.0-alpha"
dependencies = [
"async-recursion",
"async-trait",
"axum",
"axum-server",

View file

@ -115,7 +115,6 @@ lazy_static = "1.4.0"
async-trait = "0.1.68"
sd-notify = { version = "0.4.1", optional = true }
async-recursion = "1.0.5"
[target.'cfg(unix)'.dependencies]
nix = { version = "0.26.2", features = ["resource"] }

View file

@ -8,7 +8,6 @@ use std::{
time::{Duration, Instant, SystemTime},
};
use async_recursion::async_recursion;
use futures_util::{stream::FuturesUnordered, Future, StreamExt};
use ruma::{
api::{
@ -1044,8 +1043,7 @@ impl Service {
/// d. TODO: Ask other servers over federation?
#[allow(clippy::type_complexity)]
#[tracing::instrument(skip_all)]
#[async_recursion]
pub(crate) async fn fetch_and_handle_outliers<'a>(
pub(crate) fn fetch_and_handle_outliers<'a>(
&'a self,
origin: &'a ServerName,
events: &'a [Arc<EventId>],
@ -1053,7 +1051,9 @@ impl Service {
room_id: &'a RoomId,
room_version_id: &'a RoomVersionId,
pub_key_map: &'a RwLock<BTreeMap<String, BTreeMap<String, Base64>>>,
) -> Vec<(Arc<PduEvent>, Option<BTreeMap<String, CanonicalJsonValue>>)> {
) -> AsyncRecursiveType<'a, Vec<(Arc<PduEvent>, Option<BTreeMap<String, CanonicalJsonValue>>)>>
{
Box::pin(async move {
let back_off = |id| async move {
match services()
.globals
@ -1065,7 +1065,9 @@ impl Service {
hash_map::Entry::Vacant(e) => {
e.insert((Instant::now(), 1));
}
hash_map::Entry::Occupied(mut e) => *e.get_mut() = (Instant::now(), e.get().1 + 1),
hash_map::Entry::Occupied(mut e) => {
*e.get_mut() = (Instant::now(), e.get().1 + 1)
}
}
};
@ -1222,6 +1224,7 @@ impl Service {
}
}
pdus
})
}
async fn fetch_unknown_prev_events(