2026-05-18 03:47:22 +01:00
|
|
|
import * as z from 'zod';
|
|
|
|
|
|
|
|
|
|
export const ZRetentionCompactPayload = z.object({
|
|
|
|
|
/** Override default retention windows (in days). Optional. */
|
|
|
|
|
windowDays: z
|
|
|
|
|
.object({
|
|
|
|
|
mediaJob: z.number().int().positive().optional(),
|
|
|
|
|
jobStep: z.number().int().positive().optional(),
|
|
|
|
|
deadLetterJob: z.number().int().positive().optional()
|
|
|
|
|
})
|
|
|
|
|
.optional()
|
|
|
|
|
});
|
|
|
|
|
export type TRetentionCompactPayload = z.infer<typeof ZRetentionCompactPayload>;
|
|
|
|
|
|
|
|
|
|
export const ZDeadLetterCleanupPayload = z.object({
|
|
|
|
|
olderThanDays: z.number().int().positive().default(180)
|
|
|
|
|
});
|
|
|
|
|
export type TDeadLetterCleanupPayload = z.infer<typeof ZDeadLetterCleanupPayload>;
|
2026-05-20 14:07:45 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sweep `media_job` rows that are still `queued` / `running` but haven't been
|
|
|
|
|
* touched in `staleAfterMinutes`. Marks them `failed` so the active-job guard
|
|
|
|
|
* stops blocking new runs after a worker crash, server restart, or lost
|
|
|
|
|
* BullMQ job.
|
|
|
|
|
*/
|
|
|
|
|
export const ZMediaJobReapPayload = z.object({
|
|
|
|
|
staleAfterMinutes: z.number().int().positive().default(30)
|
|
|
|
|
});
|
|
|
|
|
export type TMediaJobReapPayload = z.infer<typeof ZMediaJobReapPayload>;
|