mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
When stopping, close the database (#1686)
* When stopping, close the database This patch is likely to cause errornous behavior in the application. This is due to the fact that the application doesn't gracefully shut down, but is forcefully terminated. However, the purpose is to uncover what needs to be done, to make it a more graceful shutdown.
This commit is contained in:
@@ -89,6 +89,13 @@ func Initialize(databasePath string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func Close() error {
|
||||
WriteMu.Lock()
|
||||
defer WriteMu.Unlock()
|
||||
|
||||
return DB.Close()
|
||||
}
|
||||
|
||||
func open(databasePath string, disableForeignKeys bool) *sqlx.DB {
|
||||
// https://github.com/mattn/go-sqlite3
|
||||
url := "file:" + databasePath + "?_journal=WAL"
|
||||
|
||||
Reference in New Issue
Block a user