Fix daily-log freezes and revert unrelated queue scope change

- Rewrite daily-log from synchronous fs.writeSync to async buffered
  writes (500ms flush interval), matching the main logger's pattern.
  The sync writes blocked the event loop on every log line.
- Revert the stop() queue scope change from v1.7.114 which was
  intended for a different project.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe
2026-03-24 10:03:35 +01:00
co-authored by Claude Opus 4.6
parent c51b52b86a
commit 45310f0bf7
2 changed files with 119 additions and 87 deletions
+4 -14
View File
@@ -4551,23 +4551,13 @@ export class DownloadManager extends EventEmitter {
active.abortReason = "stop";
active.abortController.abort("stop");
}
// Reset non-finished items. Items that were part of the current run
// (runItemIds) go back to "Wartet" so they are picked up by the next start().
// Items that were NOT in the run set are marked "Gestoppt" so a subsequent
// start() does not accidentally include the entire queue.
const hadRunItems = this.runItemIds.size > 0;
// Reset all non-finished items to clean "Wartet" / "Paket gestoppt" state
for (const item of Object.values(this.session.items)) {
if (!isFinishedStatus(item.status)) {
const pkg = this.session.packages[item.packageId];
const wasInRun = !hadRunItems || this.runItemIds.has(item.id);
if (wasInRun) {
item.status = "queued";
item.fullStatus = pkg && !pkg.enabled ? "Paket gestoppt" : "Wartet";
} else {
item.status = "cancelled";
item.fullStatus = "Gestoppt";
}
item.status = "queued";
item.speedBps = 0;
const pkg = this.session.packages[item.packageId];
item.fullStatus = pkg && !pkg.enabled ? "Paket gestoppt" : "Wartet";
item.updatedAt = nowMs();
}
}