Kaynağa Gözat

fix: sqlite3 and concurrent write requests caused database locked error some times, depending on how many concurrent requests and speed of disk drive. Fixed by reducign the number of concurrent db connections to 1 for sqlite3, fixes #7992

Torkel Ödegaard 8 yıl önce
ebeveyn
işleme
95e0010a5b
1 değiştirilmiş dosya ile 3 ekleme ve 0 silme
  1. 3 0
      pkg/services/sqlstore/sqlstore.go

+ 3 - 0
pkg/services/sqlstore/sqlstore.go

@@ -198,6 +198,9 @@ func LoadConfig() {
 
 
 	if DbCfg.Type == "sqlite3" {
 	if DbCfg.Type == "sqlite3" {
 		UseSQLite3 = true
 		UseSQLite3 = true
+		// only allow one connection as sqlite3 has multi threading issues that casue table locks
+		DbCfg.MaxIdleConn = 1
+		DbCfg.MaxOpenConn = 1
 	}
 	}
 	DbCfg.SslMode = sec.Key("ssl_mode").String()
 	DbCfg.SslMode = sec.Key("ssl_mode").String()
 	DbCfg.CaCertPath = sec.Key("ca_cert_path").String()
 	DbCfg.CaCertPath = sec.Key("ca_cert_path").String()