diff --git a/lib/storage/image-download-preparation.ts b/lib/storage/image-download-preparation.ts index 46da2d450..bb179fc9d 100644 --- a/lib/storage/image-download-preparation.ts +++ b/lib/storage/image-download-preparation.ts @@ -89,6 +89,6 @@ export function scheduleImageDownloadPreparation(id?: string) { worker.scanPending = false; } } - }, { durable: true }); + }); }); } diff --git a/tests/routes/canvas-download-recovery.test.ts b/tests/routes/canvas-download-recovery.test.ts index 6468113d0..ff086d343 100644 --- a/tests/routes/canvas-download-recovery.test.ts +++ b/tests/routes/canvas-download-recovery.test.ts @@ -112,10 +112,11 @@ test("the preparation deadline cancels the source body as well as its headers", test("requested downloads are prioritized with two workers before scanning background assets", async () => { let active = 0; let maximum = 0; let scans = 0; const releases: Array<() => void> = []; + const workRecords: Array<{ active: number; durable: number }> = []; const claimed: string[] = []; const saved: string[] = []; const bytes = Buffer.from("compatible PNG fixture"); const worker = serverLoader({ - "@/lib/observability/active-work": { trackRuntimeWork: (execute: () => Promise) => execute() }, + "node:fs": { writeFileSync: (_path: string, value: string) => workRecords.push(JSON.parse(value)), unlinkSync() {} }, "./image-archive-db": { claimImageDownloadTask: async (id: string) => { claimed.push(id); return { id, targetUrl: `https://cdn.example/${id}.png`, metadata: {} }; }, saveImageDownloadAsset: async (id: string) => saved.push(id), @@ -127,6 +128,7 @@ test("requested downloads are prioritized with two workers before scanning backg })("lib/storage/image-download-preparation.ts"); worker.scheduleImageDownloadPreparation("one"); worker.scheduleImageDownloadPreparation("two"); worker.scheduleImageDownloadPreparation("three"); await expect.poll(() => active).toBe(2); + expect(workRecords.at(-1)).toMatchObject({ active: 1, durable: 0 }); expect(scans).toBe(0); releases.splice(0).forEach(release => release()); await expect.poll(() => claimed.length).toBe(3);