Persist totalDownloadedAllTime across restarts

- Save settings every 30s during active downloads (not just session)
- Force settings save on shutdown and run finish
- Preserve live totalDownloadedAllTime when user saves settings
  (app-controller's stale copy no longer overwrites the counter)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe
2026-03-02 19:29:32 +01:00
co-authored by Claude Opus 4.6
parent 549328893e
commit bc70ff94cc
3 changed files with 15 additions and 3 deletions
+3
View File
@@ -133,6 +133,9 @@ export class AppController {
return this.settings;
}
// Preserve the live totalDownloadedAllTime from the download manager
const liveSettings = this.manager.getSettings();
nextSettings.totalDownloadedAllTime = Math.max(nextSettings.totalDownloadedAllTime || 0, liveSettings.totalDownloadedAllTime || 0);
this.settings = nextSettings;
saveSettings(this.storagePaths, this.settings);
this.manager.setSettings(this.settings);