️ perf(sqlserver): 延长空闲连接复用窗口

- 将 SQL Server 单条空闲连接保留时间由 30 秒延长至 30 分钟
- 保持最大连接数和 30 分钟生命周期轮换策略不变
- Oracle、OceanBase 与其他数据库继续沿用原连接池策略
- 增加空闲窗口与连接复用边界回归测试
This commit is contained in:
Syngnat
2026-07-13 17:30:23 +08:00
parent 1423ac0902
commit 0077c6dba7
2 changed files with 26 additions and 3 deletions

View File

@@ -83,6 +83,19 @@ func TestConfigureSQLConnectionPoolKeepsOneIdleSQLServerConnection(t *testing.T)
}
}
func TestSQLServerConnectionPoolIdleWindowOutlastsDefaultPingBoundary(t *testing.T) {
sqlServerIdleTime := resolveSQLConnectionPoolMaxIdleTime("sqlserver")
if sqlServerIdleTime <= defaultSQLConnMaxIdleTime {
t.Fatalf("expected SQL Server idle connection window to exceed %s, got %s", defaultSQLConnMaxIdleTime, sqlServerIdleTime)
}
if sqlServerIdleTime != defaultSQLConnMaxLifetime {
t.Fatalf("expected SQL Server idle connection window to match lifetime %s, got %s", defaultSQLConnMaxLifetime, sqlServerIdleTime)
}
if got := resolveSQLConnectionPoolMaxIdleTime("oracle"); got != defaultSQLConnMaxIdleTime {
t.Fatalf("expected Oracle idle connection window to remain %s, got %s", defaultSQLConnMaxIdleTime, got)
}
}
func TestConfigureSQLConnectionPoolDefaultDoesNotKeepIdleConnections(t *testing.T) {
dbConn := openConfiguredPoolForTest(t, "mysql")