Add delay between connection attempts

This commit is contained in:
Daniel M 2021-04-01 23:04:52 +02:00
parent 39af87fcb4
commit a6e408a5e1

View File

@ -270,6 +270,9 @@ pub async fn download_feedback_multi(url: &str, into_file: &str, rep: DlReporter
let specific_content_length = from_to.1 - from_to.0 + 1; let specific_content_length = from_to.1 - from_to.0 + 1;
// Delay each chunk-download to reduce the number of simultanious connection attempts
tokio::time::sleep(tokio::time::Duration::from_millis(50 *index as u64)).await;
download_feedback_chunks(&url, &into_file, rep, Some(from_to), true, Some(specific_content_length)).await.map_err(|e| e.to_string()) download_feedback_chunks(&url, &into_file, rep, Some(from_to), true, Some(specific_content_length)).await.map_err(|e| e.to_string())
})) }))