mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Graceful k8s shutdown
This commit is contained in:
parent
7bb6602454
commit
0a82e5721e
1 changed files with 8 additions and 3 deletions
|
|
@ -74,11 +74,16 @@ const main = async () => {
|
|||
console.log('completed job: ', job.jobId)
|
||||
})
|
||||
|
||||
process.on('SIGINT', async () => {
|
||||
console.log('[queue-processor]: Received SIGTERM. Shutting down.')
|
||||
const gracefulShutdown = async (signal: string) => {
|
||||
console.log(`[queue-processor]: Received ${signal}, closing server...`)
|
||||
await worker.close()
|
||||
await redisClient.disconnect()
|
||||
mqRedisClient.disconnect()
|
||||
})
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
process.on('SIGINT', () => gracefulShutdown('SIGINT'))
|
||||
process.on('SIGTERM', () => gracefulShutdown('SIGTERM'))
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`[queue-processor]: started`)
|
||||
|
|
|
|||
Loading…
Reference in a new issue