diff --git a/apps/server/src/modules/acquisition-organize/services/acquisition.ts b/apps/server/src/modules/acquisition-organize/services/acquisition.ts index f6cd5bf5..a9a6f36f 100644 --- a/apps/server/src/modules/acquisition-organize/services/acquisition.ts +++ b/apps/server/src/modules/acquisition-organize/services/acquisition.ts @@ -1103,12 +1103,18 @@ export function subscriptionSavePath(t: Pick { expect((await evaluateAcquisition(h.d, { sourceReleaseId: rel })).plans).toHaveLength(0); }); + it("同一种子已被别的计划占用而取消的不让位(避免取消 → 重评 → 再撞上同一任务的空转)", async () => { + const { entityId, slotId } = await movieSlot("InUse Movie"); + const rel = await release(entityId, "InUse.Movie.2024.1080p.WEB-DL.x264-GRP"); + const ev1 = await evaluateAcquisition(h.d, { sourceReleaseId: rel }); + expect(ev1.plans).toHaveLength(1); + await db() + .updateTable("acquisition_plan") + .set({ status: "cancelled", status_reason: "torrent_in_use_by_plan:00000000-0000-0000-0000-000000000000" }) + .where("id", "=", ev1.plans[0]!) + .execute(); + await releaseSlot(slotId); + expect((await evaluateAcquisition(h.d, { sourceReleaseId: rel })).plans).toHaveLength(0); + }); + it("在途计划(已提交)仍挡住同一资源", async () => { const { entityId } = await seriesSlot("Inflight Series"); const rel = await release(entityId, "Inflight.Series.S01E01.1080p.WEB-DL.x264-GRP");