From 743f91dd33268949b16bd90bb5baf74d69b6d8f3 Mon Sep 17 00:00:00 2001 From: Akkuman Date: Wed, 24 Jan 2024 13:46:55 +0800 Subject: [PATCH] fix: reduce SQLITE_BUSY --- db.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db.go b/db.go index 8021bac..04e021b 100644 --- a/db.go +++ b/db.go @@ -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) @@ -139,7 +139,7 @@ func CloseDB() error { } db, err := DB.DB() if err != nil { - return nil + return err } return db.Close() } \ No newline at end of file