mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-21 16:34:21 +08:00
⚡️ perf(sqlserver): 延长空闲连接复用窗口
- 将 SQL Server 单条空闲连接保留时间由 30 秒延长至 30 分钟 - 保持最大连接数和 30 分钟生命周期轮换策略不变 - Oracle、OceanBase 与其他数据库继续沿用原连接池策略 - 增加空闲窗口与连接复用边界回归测试
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user