Spaces:
Configuration error
Configuration error
File size: 416 Bytes
03b405b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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 };
|