Preserve selected-only run scope across stop/start cycles
When startItems() was used with a subset of items (e.g. 2000 of 6020), stopping and restarting would pick up ALL 6020 queued items instead of just the original 2000. Now stop() marks items outside the run set as "Gestoppt" so they are not automatically included in the next start(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e84859d15b
commit
c215fdd658
@ -4551,13 +4551,23 @@ export class DownloadManager extends EventEmitter {
|
||||
active.abortReason = "stop";
|
||||
active.abortController.abort("stop");
|
||||
}
|
||||
// Reset all non-finished items to clean "Wartet" / "Paket gestoppt" state
|
||||
// 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;
|
||||
for (const item of Object.values(this.session.items)) {
|
||||
if (!isFinishedStatus(item.status)) {
|
||||
item.status = "queued";
|
||||
item.speedBps = 0;
|
||||
const pkg = this.session.packages[item.packageId];
|
||||
item.fullStatus = pkg && !pkg.enabled ? "Paket gestoppt" : "Wartet";
|
||||
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.speedBps = 0;
|
||||
item.updatedAt = nowMs();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user