Spaces:
Runtime error
Runtime error
Milim
commited on
Commit
•
af3b1cb
1
Parent(s):
23f8c48
Use non-blocking sleep function
Browse filesstd::thread::sleep blocks the entire thread and thus also forces all other current requests to be halted.
src/results/aggregator.rs
CHANGED
@@ -74,7 +74,7 @@ pub async fn aggregate(
|
|
74 |
if random_delay || !debug {
|
75 |
let mut rng = rand::thread_rng();
|
76 |
let delay_secs = rng.gen_range(1..10);
|
77 |
-
|
78 |
}
|
79 |
|
80 |
// fetch results from upstream search engines simultaneously/concurrently.
|
|
|
74 |
if random_delay || !debug {
|
75 |
let mut rng = rand::thread_rng();
|
76 |
let delay_secs = rng.gen_range(1..10);
|
77 |
+
tokio::time::sleep(Duration::from_secs(delay_secs)).await;
|
78 |
}
|
79 |
|
80 |
// fetch results from upstream search engines simultaneously/concurrently.
|