I have a question regarding the reqwest crate. Maybe someone knows it better than I do.
I try to download a file, but it occasionally fails.
This is what my code looks like for downloading:
let mut tries = 0;
while tries < 5 {
let mut resp = reqwest::get(page);
match resp {
Err(e) => {
tries += 1;
if tries == 6 {
std::process::exit(1);
}
},
Ok(_) => tries = 5,
}
}
Well it seems your code can never process::exit(1). To enter the if tries == 6 block, tries should be 5 at the start of the iteration, which is not possible as it will escape the while tries < 5 condition.