Compare commits
No commits in common. "b41b7c9de6a936a8cfffc96c67054b86c91f90e9" and "ffb48a888384f14d79af8682d3c9903b4cedf918" have entirely different histories.
b41b7c9de6
...
ffb48a8883
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "real-debrid-downloader",
|
"name": "real-debrid-downloader",
|
||||||
"version": "1.7.120",
|
"version": "1.7.119",
|
||||||
"description": "Desktop downloader",
|
"description": "Desktop downloader",
|
||||||
"main": "build/main/main/main.js",
|
"main": "build/main/main/main.js",
|
||||||
"author": "Sucukdeluxe",
|
"author": "Sucukdeluxe",
|
||||||
|
|||||||
@ -354,9 +354,6 @@ export class AppController {
|
|||||||
if (this.manager.isSessionRunning()) {
|
if (this.manager.isSessionRunning()) {
|
||||||
this.manager.stop();
|
this.manager.stop();
|
||||||
}
|
}
|
||||||
// Flush any pending async saves BEFORE the update process starts.
|
|
||||||
// This ensures the queue is fully persisted to disk so it survives the restart.
|
|
||||||
this.manager.persistNowSync();
|
|
||||||
|
|
||||||
const cacheAgeMs = Date.now() - this.lastUpdateCheckAt;
|
const cacheAgeMs = Date.now() - this.lastUpdateCheckAt;
|
||||||
const cached = this.lastUpdateCheck && !this.lastUpdateCheck.error && cacheAgeMs <= 10 * 60 * 1000
|
const cached = this.lastUpdateCheck && !this.lastUpdateCheck.error && cacheAgeMs <= 10 * 60 * 1000
|
||||||
|
|||||||
@ -4696,12 +4696,9 @@ export class DownloadManager extends EventEmitter {
|
|||||||
this.pacedStartReservationByItem.clear();
|
this.pacedStartReservationByItem.clear();
|
||||||
this.nonResumableActive = 0;
|
this.nonResumableActive = 0;
|
||||||
this.session.summaryText = "";
|
this.session.summaryText = "";
|
||||||
// Persist synchronously on shutdown to guarantee data is written before process exits.
|
// Persist synchronously on shutdown to guarantee data is written before process exits
|
||||||
// Only skip if a backup was just imported (skipShutdownPersist) — the restored session
|
// Skip if a backup was just imported — the restored session on disk must not be overwritten
|
||||||
// on disk must not be overwritten. blockAllPersistence is intentionally NOT checked
|
if (!this.skipShutdownPersist && !this.blockAllPersistence) {
|
||||||
// here: it guards async/periodic saves during runtime, but shutdown must always persist
|
|
||||||
// to prevent queue loss across restarts/updates.
|
|
||||||
if (!this.skipShutdownPersist) {
|
|
||||||
const pkgCount = Object.keys(this.session.packages).length;
|
const pkgCount = Object.keys(this.session.packages).length;
|
||||||
const itemCount = Object.keys(this.session.items).length;
|
const itemCount = Object.keys(this.session.items).length;
|
||||||
logger.info(`Shutdown-Save: ${pkgCount} Pakete, ${itemCount} Items`);
|
logger.info(`Shutdown-Save: ${pkgCount} Pakete, ${itemCount} Items`);
|
||||||
@ -5033,18 +5030,6 @@ export class DownloadManager extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Synchronous persist — guarantees state is on disk before returning.
|
|
||||||
* Used before update installs to prevent queue loss. */
|
|
||||||
public persistNowSync(): void {
|
|
||||||
this.clearPersistTimer();
|
|
||||||
const pkgCount = Object.keys(this.session.packages).length;
|
|
||||||
const itemCount = Object.keys(this.session.items).length;
|
|
||||||
logger.info(`Pre-Update Sync-Save: ${pkgCount} Pakete, ${itemCount} Items`);
|
|
||||||
this.foldRuntimeIntoSettings(nowMs());
|
|
||||||
saveSession(this.storagePaths, this.session);
|
|
||||||
saveSettings(this.storagePaths, this.settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
private emitState(force = false): void {
|
private emitState(force = false): void {
|
||||||
const now = nowMs();
|
const now = nowMs();
|
||||||
const MIN_FORCE_GAP_MS = 120;
|
const MIN_FORCE_GAP_MS = 120;
|
||||||
|
|||||||
@ -257,7 +257,7 @@ function registerIpcHandlers(): void {
|
|||||||
if (result.started) {
|
if (result.started) {
|
||||||
updateQuitTimer = setTimeout(() => {
|
updateQuitTimer = setTimeout(() => {
|
||||||
app.quit();
|
app.quit();
|
||||||
}, 5000);
|
}, 900);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -881,25 +881,7 @@ export function loadSession(paths: StoragePaths): SessionState {
|
|||||||
return backup;
|
return backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last resort: try to recover from temp files left by interrupted writes
|
logger.error("Session konnte nicht geladen werden (auch Backup fehlgeschlagen)");
|
||||||
for (const kind of ["sync", "async"] as const) {
|
|
||||||
const tmpPath = sessionTempPath(paths.sessionFile, kind);
|
|
||||||
if (fs.existsSync(tmpPath)) {
|
|
||||||
const tmpSession = readSessionFile(tmpPath);
|
|
||||||
if (tmpSession && Object.keys(tmpSession.packages).length > 0) {
|
|
||||||
logger.warn(`Session aus temporaerer Datei wiederhergestellt: ${tmpPath} (${Object.keys(tmpSession.packages).length} Pakete)`);
|
|
||||||
try {
|
|
||||||
const payload = JSON.stringify({ ...tmpSession, updatedAt: Date.now() });
|
|
||||||
fs.writeFileSync(paths.sessionFile, payload, "utf8");
|
|
||||||
} catch {
|
|
||||||
// ignore restore write failure
|
|
||||||
}
|
|
||||||
return tmpSession;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.error("Session konnte nicht geladen werden (Primary, Backup und Temp-Dateien fehlgeschlagen)");
|
|
||||||
return emptySession();
|
return emptySession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user