Skip to content
File

Blob: src/worker/webdav/gc.ts

typescript24 lines
1import type { SubjectRow } from "@/worker/db/d1/schema";
2import { blobGcMessage } from "@/worker/queues/blob-gc";
3import { enqueueBlobGc } from "@/worker/r2/gc";
4import type { AppContext } from "@/worker/types";
5 
6export async function enqueueGc(
7 c: AppContext,
8 subject: SubjectRow,
9 blobs: { blobId: string; blobKey: string }[],
10): Promise<void> {
11 await enqueueBlobGc(
12 c.env,
13 blobs.map((blob) =>
14 blobGcMessage({
15 subjectId: subject.id,
16 storageId: subject.storageId,
17 blobId: blob.blobId,
18 blobKey: blob.blobKey,
19 notBeforeMs: Date.now(),
20 }),
21 ),
22 );
23}