test(download): cover deletion during preparation and late callbacks

This commit is contained in:
Levi committed 2026-11-10 09:47:59 +08:00
1 parent 917fc64046
commit 54fc0f7289
2 files changed
+123 -6

No files matched your search

+1 -6
View File
@@ -1550,12 +1550,7 @@ func (d *Downloader) doDelete(task *Task, force bool) (err error) {
defer task.lifetime.mu.Unlock()
defer func() {
if err != nil {
// Keep failed deletions recoverable, but never revive the invalidated run.
task.statusLock.Lock()
if task.Status == base.DownloadStatusRunning {
task.updateStatus(base.DownloadStatusPause)
}
task.statusLock.Unlock()
// Keep failed deletions recoverable without validating the old run.
task.lifetime.deleted.Store(false)
}
}()