cvsa/packages/crawler/mq/task/removeAllTimeoutSchedules.ts
alikia2x 1a20d5afe0
update: schedule archive snapshots to next Saturday midnight
fix: no expire when acquiring lock for classifyVideos
ref: format
2025-05-31 12:13:56 +08:00

12 lines
398 B
TypeScript

import { sql } from "@core/db/dbNew";
import logger from "@core/log/logger.ts";
export async function removeAllTimeoutSchedules() {
logger.log("Too many timeout schedules, directly removing these schedules...", "mq", "fn:scheduleCleanupWorker");
return await sql`
DELETE FROM snapshot_schedule
WHERE status IN ('pending', 'processing')
AND started_at < NOW() - INTERVAL '30 minutes'
`;
}