mirror of https://github.com/Chocobozzz/PeerTube
fix(server): cleanup db connections upon exit
parent
bfdd4d10f3
commit
8c30eb1b69
|
@ -42,7 +42,7 @@ try {
|
|||
// ----------- Database -----------
|
||||
|
||||
// Initialize database and models
|
||||
import { initDatabaseModels, checkDatabaseConnectionOrDie } from './core/initializers/database.js'
|
||||
import { initDatabaseModels, checkDatabaseConnectionOrDie, sequelizeTypescript } from './core/initializers/database.js'
|
||||
checkDatabaseConnectionOrDie()
|
||||
|
||||
import { migrate } from './core/initializers/migrator.js'
|
||||
|
@ -372,6 +372,9 @@ async function startApplication () {
|
|||
})
|
||||
|
||||
process.on('exit', () => {
|
||||
sequelizeTypescript.close()
|
||||
.catch(err => logger.error('Cannot close database connection.', { err }))
|
||||
|
||||
JobQueue.Instance.terminate()
|
||||
.catch(err => logger.error('Cannot terminate job queue.', { err }))
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue