fix restart during setup process

This commit is contained in:
lesion
2021-10-29 15:24:20 +02:00
parent df4bc563a6
commit 10d8639bf8
2 changed files with 14 additions and 10 deletions

View File

@@ -12,15 +12,16 @@ export default function () {
// close connections/port/unix socket
async function shutdown () {
if (TaskManager) { TaskManager.stop() }
nuxt.close(async () => {
log.info('Closing DB')
const sequelize = require('../server/api/models')
await sequelize.close()
process.exit()
})
log.info('Closing DB')
const sequelize = require('../server/api/models')
await sequelize.close()
process.off('SIGTERM', shutdown)
process.off('SIGINT', shutdown)
nuxt.close()
process.exit()
}
process.on('SIGTERM', shutdown)
process.on('SIGINT', shutdown)
process.on('SIGINT', shutdown)
}
this.nuxt.hook('listen', start)
}