0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-11-25 15:38:21 -05:00

Use non-blocking sleep function

std:🧵:sleep blocks the entire thread and thus also forces all other current requests to be halted.
This commit is contained in:
Milim 2023-08-17 21:45:48 +02:00
parent 23f8c482dc
commit af3b1cb308

View File

@ -74,7 +74,7 @@ pub async fn aggregate(
if random_delay || !debug { if random_delay || !debug {
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
let delay_secs = rng.gen_range(1..10); 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. // fetch results from upstream search engines simultaneously/concurrently.