Spaces:
Configuration error
Configuration error
Download src/queue/watchdog.js from UUUZCX/video-optimizer-bot: direct link, hf CLI and curl.
- Browser
- Download file 683 Bytes
-
https://huggingface.co/spaces/UUUZCX/video-optimizer-bot/resolve/main/src/queue/watchdog.js
- Command line
-
hf download hf://spaces/UUUZCX/video-optimizer-bot/src/queue/watchdog.js
-
curl -L -o watchdog.js https://huggingface.co/spaces/UUUZCX/video-optimizer-bot/resolve/main/src/queue/watchdog.js
683 Bytes
| const { listJobs, updateJob, event } = require("./jobs"); | |
| function startWatchdog(logger) { | |
| const interval = setInterval(() => { | |
| const stuckCutoff = Date.now() - 90 * 60 * 1000; | |
| for (const job of listJobs(200)) { | |
| if (!["downloading", "compressing", "uploading"].includes(job.status)) continue; | |
| if (Date.parse(job.updatedAt) < stuckCutoff) { | |
| event(job.id, "warn", "Watchdog moved a stale job back to retrying"); | |
| updateJob(job.id, { status: "retrying", stage: "watchdog-retry" }); | |
| logger.warn({ jobId: job.id }, "Watchdog recovered stale job"); | |
| } | |
| } | |
| }, 5 * 60 * 1000); | |
| interval.unref(); | |
| } | |
| module.exports = { startWatchdog }; | |