Close the database when Flamenco shuts down
This prevents SQLite journal files from lingering around.
This commit is contained in:
parent
34f0a6e676
commit
aa1c6b8ff3
@ -137,6 +137,7 @@ func runFlamencoManager() bool {
|
|||||||
|
|
||||||
// Construct the services.
|
// Construct the services.
|
||||||
persist := openDB(*configService)
|
persist := openDB(*configService)
|
||||||
|
defer persist.Close()
|
||||||
|
|
||||||
// Disabled for now. `VACUUM` locks the database, which means that other
|
// Disabled for now. `VACUUM` locks the database, which means that other
|
||||||
// queries can fail with a "database is locked (5) (SQLITE_BUSY)" error. This
|
// queries can fail with a "database is locked (5) (SQLITE_BUSY)" error. This
|
||||||
|
@ -149,3 +149,12 @@ func (db *DB) vacuum() {
|
|||||||
log.Error().Err(tx.Error).Msg("error vacuuming database")
|
log.Error().Err(tx.Error).Msg("error vacuuming database")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close closes the connection to the database.
|
||||||
|
func (db *DB) Close() error {
|
||||||
|
sqldb, err := db.gormDB.DB()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return sqldb.Close()
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user