Skip to content

Commit

Permalink
Use shared sqlite connection on non windows
Browse files Browse the repository at this point in the history
  • Loading branch information
surik committed Sep 14, 2023
1 parent 3a112b4 commit 1de1aea
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion management/server/sqlite_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1de1aea

Please sign in to comment.