Merge pull request #139 from pickles976/retry-downloads

Retry Failed Downloads
This commit is contained in:
2024-08-25 15:26:12 +02:00
committed by GitHub

View File

@@ -258,6 +258,10 @@ async fn update_dir(
fs::create_dir_all(parent).unwrap();
}
}
// Prompt user to retry downloads if they fail
let mut download_complete : bool = false;
while !download_complete {
if let Err(err) = http_async::download_file_progress(
&client,
pb,
@@ -267,8 +271,15 @@ async fn update_dir(
)
.await
{
println!("Failed to download file {}, retry? (Y/n)", file_path.clone().display());
let input = misc::stdin().to_ascii_lowercase();
if input == "n" {
panic!("{err}");
}
};
download_complete = true;
}
let hash = misc::file_blake3(&file_path).unwrap();
hashes.insert(file_name.to_owned(), hash.to_lowercase());
#[cfg(unix)]