Skip to content

Commit

Permalink
fix: reduce SQLITE_BUSY
Browse files Browse the repository at this point in the history
  • Loading branch information
akkuman committed Jan 24, 2024
1 parent 0b4358c commit 743f91d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func init() {
}

// https://github.com/glebarez/sqlite/issues/52#issuecomment-1214160902
DB, err = gorm.Open(sqlite.Open("file:db.db?_pragma=journal_mode(WAL)&_pragma=busy_timeout(10000)"), &gorm.Config{
DB, err = gorm.Open(sqlite.Open("file:db.db?cache=shared&_pragma=journal_mode(WAL)&_pragma=busy_timeout(10000)"), &gorm.Config{
Logger: logger.Discard,
})
checkErr(err)
Expand Down Expand Up @@ -139,7 +139,7 @@ func CloseDB() error {
}
db, err := DB.DB()
if err != nil {
return nil
return err
}
return db.Close()
}

0 comments on commit 743f91d

Please sign in to comment.