From af3b1cb3081f4b585f645597cda0f9177408b711 Mon Sep 17 00:00:00 2001 From: Milim <81323548+MilimTheTrueOne@users.noreply.github.com> Date: Thu, 17 Aug 2023 21:45:48 +0200 Subject: [PATCH] Use non-blocking sleep function std::thread::sleep blocks the entire thread and thus also forces all other current requests to be halted. --- src/results/aggregator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/results/aggregator.rs b/src/results/aggregator.rs index 4ffaaf5..77c2f71 100644 --- a/src/results/aggregator.rs +++ b/src/results/aggregator.rs @@ -74,7 +74,7 @@ pub async fn aggregate( if random_delay || !debug { let mut rng = rand::thread_rng(); let delay_secs = rng.gen_range(1..10); - std::thread::sleep(Duration::from_secs(delay_secs)); + tokio::time::sleep(Duration::from_secs(delay_secs)).await; } // fetch results from upstream search engines simultaneously/concurrently.