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

This commit is contained in:
Tiger Wang 2022-12-02 17:25:44 -05:00 committed by GitHub
parent 3875827b7a
commit be9a010d17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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))