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:
parent
23f8c482dc
commit
af3b1cb308
1 changed files with 1 additions and 1 deletions
|
@ -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.
|
||||||
|
|
Loading…
Add table
Reference in a new issue