Update-Neustart: laufende Downloads als queued parken statt als "Gestoppt" haengenzubleiben
Beim Update parkte installUpdate() aktive Downloads via stop() -> deren Abbruch-
Continuation markierte die Items "cancelled"/"Gestoppt". autoResumeOnStart nimmt
nach dem Neustart aber nur "queued"/"reconnect_wait" auf, also liefen die gerade
ladenden Downloads nach dem Update nicht weiter (timing-abhaengig: "manchmal").
Jetzt: stop({parkForRestart:true}) bricht aktive Tasks mit Grund "shutdown" ab,
sodass sie als "queued" re-queued werden (wie bei normalem App-Shutdown). Das
schliesst zugleich den einzigen plausiblen Loesch-Pfad (all-cancelled-Pakete sind
ueber applyRetroactiveCleanupPolicy entfernbar). Stop-Button-Verhalten unveraendert.
Zusaetzliche Robustheit in storage.ts (enge Blast-Radien, nicht die Hauptursache):
- async-Save-Clobber: eine gequeuete, veraltete Payload konnte einen neueren
Sync-Save (persistNowSync/prepareForShutdown) ueberschreiben; Generation wird
jetzt zum Snapshot-Zeitpunkt erfasst und durch die Queue getragen.
- loadSession gab leer zurueck (und ignorierte ein gefuelltes .bak), wenn die
Primaerdatei fehlte; faellt jetzt auf die Backup/Temp-Recovery zurueck.
Regressionstests: tests/update-restart-resume.test.ts (echter Live-Download ->
Park -> Reload = queued, plus Charakterisierung plain stop() -> cancelled) und
tests/session-restart-loss.test.ts (Clobber + Backup-Fallback). Volle Suite gruen.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
53cc6b11eb
commit
8d03ca124f
@@ -5689,7 +5689,15 @@ export class DownloadManager extends EventEmitter {
|
||||
});
|
||||
}
|
||||
|
||||
public stop(): void {
|
||||
public stop(options?: { parkForRestart?: boolean }): void {
|
||||
// parkForRestart: used before an app-update install. Active downloads are
|
||||
// aborted with the "shutdown" reason so their continuation re-queues them
|
||||
// (status "queued") instead of marking them "cancelled"/"Gestoppt". A
|
||||
// cancelled item is NOT picked up by autoResumeOnStart after the update
|
||||
// relaunch, so the download would silently fail to resume — the user sees
|
||||
// packages that were downloading "disappear" from the active list.
|
||||
const parkForRestart = options?.parkForRestart === true;
|
||||
const abortReason: "stop" | "shutdown" = parkForRestart ? "shutdown" : "stop";
|
||||
const keepExtraction = this.settings.autoExtractWhenStopped;
|
||||
this.schedulerGeneration += 1;
|
||||
this.session.running = false;
|
||||
@@ -5713,8 +5721,8 @@ export class DownloadManager extends EventEmitter {
|
||||
this.packagePostProcessActive = 0;
|
||||
}
|
||||
for (const active of this.activeTasks.values()) {
|
||||
active.abortReason = "stop";
|
||||
active.abortController.abort("stop");
|
||||
active.abortReason = abortReason;
|
||||
active.abortController.abort(abortReason);
|
||||
}
|
||||
// Reset all non-finished items to clean "Wartet" / "Paket gestoppt" state
|
||||
for (const item of Object.values(this.session.items)) {
|
||||
|
||||
Reference in New Issue
Block a user