feat(config): Update timeout settings for connections
Some checks failed
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Successful in -22m34s
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Successful in -22m28s
Build , Vet Test, and Lint / Build (push) Successful in -26m3s
Build , Vet Test, and Lint / Lint Code (push) Successful in -25m22s
Tests / Integration Tests (push) Failing after -26m44s
Tests / Unit Tests (push) Successful in -26m2s

* Set default query timeout to 2 minutes and enforce minimum.
* Add statement_timeout for PostgreSQL DSN.
* Implement busy timeout for SQLite with a minimum of 2 minutes.
* Enforce minimum connection timeouts of 10 minutes for server instance.
This commit is contained in:
Hein
2026-01-26 11:06:16 +02:00
parent 09f2256899
commit 07016d1b73
3 changed files with 61 additions and 10 deletions

View File

@@ -76,8 +76,12 @@ func (p *SQLiteProvider) Connect(ctx context.Context, cfg ConnectionConfig) erro
// Don't fail connection if WAL mode cannot be enabled
}
// Set busy timeout to handle locked database
_, err = db.ExecContext(ctx, "PRAGMA busy_timeout=5000")
// Set busy timeout to handle locked database (minimum 2 minutes = 120000ms)
busyTimeout := cfg.GetQueryTimeout().Milliseconds()
if busyTimeout < 120000 {
busyTimeout = 120000 // Enforce minimum of 2 minutes
}
_, err = db.ExecContext(ctx, fmt.Sprintf("PRAGMA busy_timeout=%d", busyTimeout))
if err != nil {
if cfg.GetEnableLogging() {
logger.Warn("Failed to set busy timeout for SQLite", "error", err)