Skip to content

CasaOS - A simple, easy-to-use, elegant open-source Personal Cloud system.

fix sqlite db lock by reducing maximum open connections to 1 (#732)

Tiger Wangbe9a010d17ff
diff --git a/pkg/sqlite/db.go b/pkg/sqlite/db.go
index 0f6536b..be826a4 100644
--- a/pkg/sqlite/db.go
+++ b/pkg/sqlite/db.go
@@ -34,7 +34,7 @@ func GetDb(dbPath string) *gorm.DB {
db, err := gorm.Open(sqlite.Open(dbPath+"/casaOS.db"), &gorm.Config{})
c, _ := db.DB()
c.SetMaxIdleConns(10)
- c.SetMaxOpenConns(100)
+ c.SetMaxOpenConns(1)
c.SetConnMaxIdleTime(time.Second * 1000)
if err != nil {
logger.Error("sqlite connect error", zap.Any("db connect error", err))