Просмотр исходного кода

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 4 недель назад
Родитель
Сommit
9ffce6e3ff
2 измененных файлов с 2 добавлено и 1 удалено
  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.SetMaxIdleConns(maxConns)
 
 	for _, pragma := range pragmas {
 		if _, err := sqlDB.Exec("PRAGMA " + pragma); err != nil {

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

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