Spaces:
Configuration error
Configuration error
Download src/queue/shutdown.js from UUUZCX/video-optimizer-bot: direct link, hf CLI and curl.
- Browser
- Download file 416 Bytes
-
https://huggingface.co/spaces/UUUZCX/video-optimizer-bot/resolve/main/src/queue/shutdown.js
- Command line
-
hf download hf://spaces/UUUZCX/video-optimizer-bot/src/queue/shutdown.js
-
curl -L -o shutdown.js https://huggingface.co/spaces/UUUZCX/video-optimizer-bot/resolve/main/src/queue/shutdown.js
416 Bytes
| function registerGracefulShutdown(queue, logger) { | |
| let shuttingDown = false; | |
| async function stop(signal) { | |
| if (shuttingDown) return; | |
| shuttingDown = true; | |
| logger.info({ signal }, "Graceful shutdown started"); | |
| queue.pause(); | |
| await queue.waitForIdle(30_000); | |
| process.exit(0); | |
| } | |
| process.on("SIGINT", stop); | |
| process.on("SIGTERM", stop); | |
| } | |
| module.exports = { registerGracefulShutdown }; | |