fix(download): 连续 3 轮查不到才判移除(M1)
qB 列表与按 hash 都查不到时先记 missing_since / missing_count,连续 MISSING_CONFIRM_ROUNDS(3) 轮才判 removed;中途重新出现或只是去掉管理标签即清零。相关测试改为同步多轮后再断言移除。 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
cba5de731b
commit
d96f0ff19f
4 files changed
+25
-6
No files matched your search
@@ -2,7 +2,11 @@ import { createQbClient } from "@umt/adapters";
|
||||
import { createMockQb, createTempTree, type MockQb, makeTorrent, type TempTree } from "@umt/testkit";
|
||||
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
||||
import { evaluateAcquisition } from "../../src/modules/acquisition-organize/services/acquisition.ts";
|
||||
import { submitDownload, syncDownloads } from "../../src/modules/acquisition-organize/services/downloads.ts";
|
||||
import {
|
||||
MISSING_CONFIRM_ROUNDS,
|
||||
submitDownload,
|
||||
syncDownloads,
|
||||
} from "../../src/modules/acquisition-organize/services/downloads.ts";
|
||||
import { executeRecord, planImport } from "../../src/modules/acquisition-organize/services/organize.ts";
|
||||
import {
|
||||
applyEpisodeTotal,
|
||||
@@ -159,7 +163,7 @@ describe.skipIf(!hasPg)("订阅增强(真实 PG + mock qB + 临时目录)", () =
|
||||
// 用户在 qB 里删掉 E02:确认移除 → 计划失败释放单元 → Slot 到期重评 → 延后的 E02 另一版本得到计划
|
||||
const qc = createQbClient({ instanceId: "t", baseUrl: qb.url, username: "admin", password: "adminadmin" });
|
||||
await qc.delete([e2.hash], { deleteFiles: false });
|
||||
await syncDownloads(h.d);
|
||||
for (let i = 0; i < MISSING_CONFIRM_ROUNDS; i++) await syncDownloads(h.d);
|
||||
expect(await planRow(p2)).toMatchObject({ status: "failed", status_reason: "download_removed" });
|
||||
expect((await slotRow(slotId)).status).toBe("attention");
|
||||
h.engine.enqueued.length = 0;
|
||||
|
||||
Reference in new issue
Block a user