From 1de1aeaadb60a3074f2e9504ee035ae512f6c2db Mon Sep 17 00:00:00 2001 From: Yury Gargay Date: Tue, 12 Sep 2023 15:36:18 +0200 Subject: [PATCH] Use shared sqlite connection on non windows --- management/server/sqlite_store.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/management/server/sqlite_store.go b/management/server/sqlite_store.go index 78fb35e57bd..b2115d5baf1 100644 --- a/management/server/sqlite_store.go +++ b/management/server/sqlite_store.go @@ -33,7 +33,13 @@ type installation struct { // NewSqliteStore restores a store from the file located in the datadir func NewSqliteStore(dataDir string, metrics telemetry.AppMetrics) (*SqliteStore, error) { - file := filepath.Join(dataDir, "store.db") + storeStr := "store.db?cache=shared" + if runtime.GOOS == "windows" { + // Vo avoid `The process cannot access the file because it is being used by another process` on Windows + storeStr = "store.db" + } + + file := filepath.Join(dataDir, storeStr) db, err := gorm.Open(sqlite.Open(file), &gorm.Config{ Logger: logger.Default.LogMode(logger.Silent), PrepareStmt: true,