Hide generic waiting states in queue
This commit is contained in:
parent
fff0589154
commit
83c0c18dca
@ -5567,7 +5567,7 @@ export class DownloadManager extends EventEmitter {
|
||||
|
||||
private getVisiblePacedStartBudget(): number {
|
||||
const maxParallel = Math.max(1, Number(this.settings.maxParallel) || 1);
|
||||
return Math.max(0, maxParallel - this.activeTasks.size);
|
||||
return this.activeTasks.size < maxParallel ? 1 : 0;
|
||||
}
|
||||
|
||||
private delayPacedStartForItem(item: DownloadItem, now: number): boolean {
|
||||
|
||||
@ -5537,6 +5537,9 @@ const PackageCard = memo(function PackageCard({ pkg, items, packageSpeed, stripe
|
||||
|
||||
const getDisplayedItemStatus = (item: DownloadItem): string => {
|
||||
const statusText = String(item.fullStatus || "").trim();
|
||||
if (statusText === "Wartet") {
|
||||
return "";
|
||||
}
|
||||
if (sessionRunning) {
|
||||
return statusText;
|
||||
}
|
||||
|
||||
@ -4838,7 +4838,7 @@ describe("download manager", () => {
|
||||
}
|
||||
}, 20000);
|
||||
|
||||
it("shows AllDebrid countdowns only for the next visible start wave", async () => {
|
||||
it("shows only the next AllDebrid item with a visible countdown", async () => {
|
||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), "rd-dm-"));
|
||||
tempDirs.push(root);
|
||||
const chunk = Buffer.alloc(256 * 1024, 9);
|
||||
@ -4926,7 +4926,8 @@ describe("download manager", () => {
|
||||
const countdownItems = items.filter((item) => /^AllDebrid Start in \d+s$/.test(item.fullStatus || ""));
|
||||
const plainQueuedItems = items.filter((item) => (item.status === "queued" || item.status === "reconnect_wait") && item.fullStatus === "Wartet");
|
||||
|
||||
expect(countdownItems.length).toBeLessThanOrEqual(Math.max(0, 5 - activeCount));
|
||||
expect(activeCount).toBeGreaterThan(0);
|
||||
expect(countdownItems.length).toBeLessThanOrEqual(1);
|
||||
expect(plainQueuedItems.length).toBeGreaterThan(0);
|
||||
|
||||
manager.stop();
|
||||
@ -5021,14 +5022,18 @@ describe("download manager", () => {
|
||||
manager.addPackages([{ name: "ad-paced", links: [link1, link2, link3] }]);
|
||||
await manager.start();
|
||||
|
||||
const managerInternals = manager as unknown as { retryAfterByItem: Map<string, number> };
|
||||
await waitFor(() => managerInternals.retryAfterByItem.size >= 2, 5000);
|
||||
const managerInternals = manager as unknown as {
|
||||
retryAfterByItem: Map<string, number>;
|
||||
providerStartReservations: Map<string, number>;
|
||||
};
|
||||
await waitFor(() => managerInternals.retryAfterByItem.size >= 1 && managerInternals.providerStartReservations.size >= 1, 5000);
|
||||
|
||||
const now = Date.now();
|
||||
const readyTimes = [...managerInternals.retryAfterByItem.values()].sort((a, b) => a - b);
|
||||
expect(readyTimes.length).toBeGreaterThanOrEqual(2);
|
||||
expect(readyTimes.length).toBeGreaterThanOrEqual(1);
|
||||
const firstDelay = readyTimes[0] - now;
|
||||
const secondDelay = readyTimes[1] - now;
|
||||
const nextReservation = managerInternals.providerStartReservations.get("alldebrid") || 0;
|
||||
const secondDelay = nextReservation - now;
|
||||
expect(firstDelay).toBeGreaterThan(1500);
|
||||
expect(firstDelay).toBeLessThan(6500);
|
||||
expect(secondDelay).toBeGreaterThan(firstDelay + 1200);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user