Log SIGINT & SIGTERM.
This commit is contained in:
parent
49a49e2a2c
commit
127f4446ae
16
src/index.js
16
src/index.js
@ -447,10 +447,18 @@ export default async function main (args) {
|
||||
info('Default user created:', email, ' with password', password)
|
||||
}
|
||||
|
||||
// Handle gracefully shutdown.
|
||||
const closeWebServer = () => { webServer.close() }
|
||||
process.on('SIGINT', closeWebServer)
|
||||
process.on('SIGTERM', closeWebServer)
|
||||
// Gracefully shutdown on signals.
|
||||
//
|
||||
// TODO: implements a timeout? (or maybe it is the services launcher
|
||||
// responsability?)
|
||||
process.on('SIGINT', () => {
|
||||
debug('SIGINT caught, closing web server…')
|
||||
webServer.close()
|
||||
})
|
||||
process.on('SIGTERM', () => {
|
||||
debug('SIGTERM caught, closing web server…')
|
||||
webServer.close()
|
||||
})
|
||||
|
||||
return eventToPromise(webServer, 'close')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user