Skip to content

Commit 866189c

Browse files
authored
opt: avoid too many database is locked (#663)
1 parent b9450d7 commit 866189c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pkg/storage/sqlite.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ type SQLiteDB struct {
3333
}
3434

3535
func NewSQLiteDB(dbPath string) (DB, error) {
36-
db, err := sql.Open("sqlite3", dbPath)
36+
dsn := fmt.Sprintf("file:%s?_busy_timeout=5000&_journal_mode=WAL", dbPath)
37+
db, err := sql.Open("sqlite3", dsn)
3738
if err != nil {
3839
return nil, xerror.Wrapf(err, xerror.DB, "sqlite: open sqlite3 path %s failed", dbPath)
3940
}

0 commit comments

Comments
 (0)