Procházet zdrojové kódy

chore(sqlite): reduce max open connections, keep them open permanently (fixes #10592) (#10596)

chore(sqlite): reduce max open connections, keep them open permanently (fixes #10592)

Reduces connection churn, possibly tickling concurrency bug on Windows.

Signed-off-by: Jakob Borg <[email protected]>
Jakob Borg před 4 týdny
rodič
revize
9ffce6e3ff
2 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 1 0
      internal/db/sqlite/basedb.go
  2. 1 1
      internal/db/sqlite/db_open.go

+ 1 - 0
internal/db/sqlite/basedb.go

@@ -63,6 +63,7 @@ func openBase(path string, maxConns int, pragmas, schemaScripts, migrationScript
 	}
 	}
 
 
 	sqlDB.SetMaxOpenConns(maxConns)
 	sqlDB.SetMaxOpenConns(maxConns)
+	sqlDB.SetMaxIdleConns(maxConns)
 
 
 	for _, pragma := range pragmas {
 	for _, pragma := range pragmas {
 		if _, err := sqlDB.Exec("PRAGMA " + pragma); err != nil {
 		if _, err := sqlDB.Exec("PRAGMA " + pragma); err != nil {

+ 1 - 1
internal/db/sqlite/db_open.go

@@ -20,7 +20,7 @@ import (
 )
 )
 
 
 const (
 const (
-	maxDBConns         = 16
+	maxDBConns         = 6
 	minDeleteRetention = 24 * time.Hour
 	minDeleteRetention = 24 * time.Hour
 )
 )