diff --git a/Cargo.lock b/Cargo.lock index 32e3227..58b585b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -100,17 +100,6 @@ version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" -[[package]] -name = "async-recursion" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - [[package]] name = "async-stream" version = "0.3.5" @@ -1122,7 +1111,6 @@ checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" name = "nix-weather" version = "0.0.1" dependencies = [ - "async-recursion", "clap", "clap_complete", "clap_mangen", diff --git a/crates/nix-weather/Cargo.toml b/crates/nix-weather/Cargo.toml index ab0c7e6..8140899 100644 --- a/crates/nix-weather/Cargo.toml +++ b/crates/nix-weather/Cargo.toml @@ -16,7 +16,6 @@ publish = false build = "build.rs" [dependencies] -async-recursion = "1.0.5" clap = { version = "4.5.1", features = ["cargo"] } console-subscriber = "0.2.0" dns-lookup = "2.0.4" diff --git a/crates/nix-weather/src/net.rs b/crates/nix-weather/src/net.rs index 6f693cd..902e3b1 100644 --- a/crates/nix-weather/src/net.rs +++ b/crates/nix-weather/src/net.rs @@ -5,7 +5,6 @@ use std::time::Duration; -use async_recursion::async_recursion; use reqwest::Client; use tokio::time::sleep; @@ -13,7 +12,6 @@ use log; const MAX_SLIDE: u64 = 1000; -#[async_recursion] pub async fn nar_exists(client: Client, domain: &str, hash: &str, slide: u64) -> usize { let response = client .head(format!("https://{domain}/{hash}.narinfo")) @@ -30,7 +28,13 @@ pub async fn nar_exists(client: Client, domain: &str, hash: &str, slide: u64) -> // so we do this instead. log::trace!("rate limited! {slide}"); sleep(Duration::from_millis(slide)).await; - nar_exists(client, domain, hash, std::cmp::min(slide * 2, MAX_SLIDE)).await + Box::pin(nar_exists( + client, + domain, + hash, + std::cmp::min(slide * 2, MAX_SLIDE), + )) + .await } } }