0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-10-18 06:22:53 -04:00

🐛 fix(search): Resolve random delay condition during search for individual/non-production self-hosted server (#617)

This commit is contained in:
Zacherina 2024-10-07 05:28:06 +05:30 committed by GitHub
parent 959d0c52b1
commit 42c30aaaba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -85,7 +85,7 @@ pub async fn search(
let next_page = page + 1; let next_page = page + 1;
// Add a random delay before making the request. // Add a random delay before making the request.
if config.aggregator.random_delay || !config.debug { if config.aggregator.random_delay || config.debug {
let nanos = SystemTime::now().duration_since(UNIX_EPOCH)?.subsec_nanos() as f32; let nanos = SystemTime::now().duration_since(UNIX_EPOCH)?.subsec_nanos() as f32;
let delay = ((nanos / 1_0000_0000 as f32).floor() as u64) + 1; let delay = ((nanos / 1_0000_0000 as f32).floor() as u64) + 1;
tokio::time::sleep(Duration::from_secs(delay)).await; tokio::time::sleep(Duration::from_secs(delay)).await;