fix: sqlite concurrency
This commit is contained in:
parent
805cf9024b
commit
97a17097ef
1 changed files with 2 additions and 1 deletions
3
db/db.go
3
db/db.go
|
|
@ -27,10 +27,11 @@ type XDCount struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Open(path string) (*DB, error) {
|
func Open(path string) (*DB, error) {
|
||||||
d, err := sql.Open("sqlite", path)
|
d, err := sql.Open("sqlite", path+"?_journal_mode=WAL&_busy_timeout=5000")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
d.SetMaxOpenConns(1)
|
||||||
db := &DB{d}
|
db := &DB{d}
|
||||||
if err := db.migrate(); err != nil {
|
if err := db.migrate(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue