Fix: Mega-Debrid Einzel-Account friert bei 60s-Timeout nicht mehr die ganze Liste ein
Symptom (per Ferndiagnose live verifiziert): Bei nur EINEM Mega-Debrid-Account lief der Download eine Weile sauber, dann standen schlagartig ALLE Items ~120s im "Mega-Debrid Cooldown" — obwohl der Account voellig gesund war (andere Links loesten zeitgleich in 13-18s auf). Jede Cooldown-Zeile zeigte exakt dieselbe Deadline (20:52:55.901) -> ein einziger account-weiter Cooldown, einmal gesetzt. Ursache: Laeuft eine Web-Aufloesung laenger als das 60s-Gesamt-Timeout, feuert der Abbruch-Pfad (debrid.ts) einen 120s-Account-Cooldown. Dessen einziger Zweck (laut Code-Kommentar) ist, den Retry auf den NAECHSTEN Account rotieren zu lassen. Bei nur einem Account gibt es keinen naechsten -> stattdessen findet jedes folgende Item den einzigen Account im Cooldown und wird bis zu 120s geparkt -> die ganze Liste steht. Ein 60s-Timeout ist ein Signal fuer einen LANGSAMEN LINK, nicht fuer einen ungesunden Account. Fix: Der Account-Cooldown wird nur noch gesetzt, wenn es tatsaechlich einen anderen nutzbaren Account zum Rotieren gibt. Ohne Rotationsziel (Einzel-Account / alle anderen belegt) wird der Account NICHT mehr eingefroren; stattdessen wird nur der langsame Link selbst geparkt (mega_debrid_slow_link -> Item-Retry), waehrend alle anderen Items weiter ueber den gesunden Account laufen. Das Mehr-Account-Verhalten (Rotation per Account-Cooldown) bleibt unveraendert. Der baugleiche Debrid-Link-Pfad (Einzel-Key, debrid.ts) ist derselbe Muster-Typ, aber ein separater, hier nicht genutzter Provider mit eigener Nachbehandlung - bewusst nicht mitgebuendelt. Tests: debrid.test.ts (Einzel-Account-Abbruch parkt nur den Link, KEIN Account-Cooldown, zweites Item loest weiter auf) + unrestrict-retry.test.ts (parseMegaDebridSlowLinkRetry, keine Token-Kollision). Suite 934 gruen, tsc 6.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { transientResolveRetryDelayMs, parseMegaDebridCooldownRetry, parseMegaDebridResetPark } from "../src/main/download-manager";
|
||||
import { transientResolveRetryDelayMs, parseMegaDebridCooldownRetry, parseMegaDebridResetPark, parseMegaDebridSlowLinkRetry } from "../src/main/download-manager";
|
||||
|
||||
describe("transientResolveRetryDelayMs (fast, bounded retry for transient resolve failures)", () => {
|
||||
it("starts fast (<= 3s) instead of the 5s..120s exponential", () => {
|
||||
@@ -63,6 +63,31 @@ describe("parseMegaDebridCooldownRetry (honor the encoded account-cooldown delay
|
||||
});
|
||||
});
|
||||
|
||||
describe("parseMegaDebridSlowLinkRetry (park only the slow link, never the account)", () => {
|
||||
it("parses the encoded delay from a slow-link error", () => {
|
||||
const r = parseMegaDebridSlowLinkRetry("mega_debrid_slow_link:120000:Mega-Debrid (Account 1/1, Su******e3): aborted");
|
||||
expect(r).not.toBeNull();
|
||||
expect(r!.delayMs).toBe(120000);
|
||||
expect(r!.detail).toContain("Mega-Debrid");
|
||||
});
|
||||
|
||||
it("parses it when embedded in the aggregated provider-chain error", () => {
|
||||
const aggregated = "Provider-Kette: Mega-Debrid Web fehlgeschlagen (Error: mega_debrid_slow_link:90000:Mega-Debrid (Account 1/1): aborted)";
|
||||
expect(parseMegaDebridSlowLinkRetry(aggregated)!.delayMs).toBe(90000);
|
||||
});
|
||||
|
||||
it("clamps to [1s, 15min]", () => {
|
||||
expect(parseMegaDebridSlowLinkRetry("mega_debrid_slow_link:1:x")!.delayMs).toBe(1000);
|
||||
expect(parseMegaDebridSlowLinkRetry("mega_debrid_slow_link:99999999:x")!.delayMs).toBe(15 * 60 * 1000);
|
||||
});
|
||||
|
||||
it("does not collide with the account-cooldown or reset-park tokens", () => {
|
||||
expect(parseMegaDebridSlowLinkRetry("mega_debrid_cooldown:20330:x")).toBeNull();
|
||||
expect(parseMegaDebridSlowLinkRetry("mega_debrid_reset_park:43200000:x")).toBeNull();
|
||||
expect(parseMegaDebridCooldownRetry("mega_debrid_slow_link:120000:x")).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("parseMegaDebridResetPark (park the item until the Tagesreset, not a ~2min generic retry)", () => {
|
||||
it("parses the encoded until-reset delay from the park token", () => {
|
||||
const r = parseMegaDebridResetPark("mega_debrid_reset_park:43200000:Mega-Debrid: Alle Accounts am Tageslimit (bis zum Tagesreset gesperrt)");
|
||||
|
||||
Reference in New Issue
Block a user