Handle SIGINT in server better by moving DB call to after redis shutdown
This commit is contained in:
@ -190,12 +190,14 @@ const main = async (): Promise<void> => {
|
||||
listener.timeout = 640 * 1000 // match headersTimeout
|
||||
|
||||
process.on('SIGINT', async () => {
|
||||
await appDataSource.destroy()
|
||||
console.log('DB connection closed.')
|
||||
|
||||
// Shutdown redis before DB because the quit sequence can
|
||||
// cause appDataSource to get reloaded in the callback
|
||||
await redisDataSource.shutdown()
|
||||
console.log('Redis connection closed.')
|
||||
|
||||
await appDataSource.destroy()
|
||||
console.log('DB connection closed.')
|
||||
|
||||
process.exit(0)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user