mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 19:44:59 +03:00
Prevent server crash on mongo unhandled rejection (#771)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
4328fdee9b
commit
c53647b7e8
@ -33,10 +33,15 @@ if (elasticUrl === undefined) {
|
||||
const shutdown = start(url, elasticUrl, 3333)
|
||||
|
||||
const close = (): void => {
|
||||
console.error(new Error().stack)
|
||||
console.trace('Exiting from server')
|
||||
console.log('Shutdown request accepted')
|
||||
shutdown()
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
process.on('unhandledRejection', (reason, promise) => {
|
||||
console.log('Unhandled Rejection at:', promise, 'reason:', reason)
|
||||
})
|
||||
|
||||
process.on('SIGINT', close)
|
||||
process.on('SIGTERM', close)
|
||||
|
Loading…
Reference in New Issue
Block a user