mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 04:55:44 +00:00
Report a cancelled Epic or EA download as cancelled when its last fetch also failed
A cancel on the final fetch attempt can leave a recorded fetch error. Check the cancel flag first so the job ends cancelled.
This commit is contained in:
1 parent
2c823f070b
commit
e48c83d083
2 files changed
+6
-6
No files matched your search
@@ -807,13 +807,13 @@ pub fn run(req: &Request, cancel: &AtomicBool, ev: &dyn Events) -> Result<Finish
|
||||
return Err(Stop::Failed(message));
|
||||
}
|
||||
if !placed_all {
|
||||
if cancel.load(Ordering::SeqCst) {
|
||||
return Err(Stop::Cancelled);
|
||||
}
|
||||
if let Some(error) = outcome.as_ref().and_then(|o| o.error.clone()) {
|
||||
ev.log(&format!("download failed: {error}"));
|
||||
return Err(Stop::Failed("A file failed to download".into()));
|
||||
}
|
||||
if cancel.load(Ordering::SeqCst) {
|
||||
return Err(Stop::Cancelled);
|
||||
}
|
||||
return Err(Stop::Failed("The download ended before every file was written".into()));
|
||||
}
|
||||
|
||||
|
||||
@@ -631,12 +631,12 @@ fetches={} refetches={} peak_cache_mib={} hosts={}",
|
||||
if complete {
|
||||
return Ok(Stats { bytes_written: written, files_written: input.files.len() });
|
||||
}
|
||||
if let Some(message) = fetch_error {
|
||||
return Err(Stop::Failed(format!("Download failed: {}", tidy_fetch_error(&message))));
|
||||
}
|
||||
if stop.load(Ordering::SeqCst) {
|
||||
return Err(Stop::Cancelled);
|
||||
}
|
||||
if let Some(message) = fetch_error {
|
||||
return Err(Stop::Failed(format!("Download failed: {}", tidy_fetch_error(&message))));
|
||||
}
|
||||
Err(Stop::Failed("The download ended before every file was written".into()))
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user