️ perf(kingbase): 优化数据表首屏加载性能

- 连接池保留 Kingbase 空闲连接,减少重复建连开销
- 首屏数据查询完成后再加载编辑定位元数据
- 合并列、索引和外键元数据请求并保留强制刷新
- 新增连接复用、加载时序和请求缓存回归测试
This commit is contained in:
Syngnat
2026-07-30 11:26:50 +08:00
parent c42a8679e9
commit 09a1bceabf
9 changed files with 281 additions and 15 deletions

View File

@@ -83,6 +83,24 @@ func TestConfigureSQLConnectionPoolKeepsOneIdleSQLServerConnection(t *testing.T)
}
}
func TestConfigureSQLConnectionPoolKeepsOneIdleKingbaseConnection(t *testing.T) {
dbConn := openConfiguredPoolForTest(t, "kingbase")
if err := dbConn.PingContext(context.Background()); err != nil {
t.Fatalf("first ping failed: %v", err)
}
if err := dbConn.PingContext(context.Background()); err != nil {
t.Fatalf("second ping failed: %v", err)
}
if got := poolRecordingOpenCount.Load(); got != 1 {
t.Fatalf("expected Kingbase pool to reuse one idle connection, opened %d connections", got)
}
if got := poolRecordingCloseCount.Load(); got != 0 {
t.Fatalf("expected Kingbase idle connection to remain cached before DB close, closed %d connections", got)
}
}
func TestSQLServerConnectionPoolIdleWindowOutlastsDefaultPingBoundary(t *testing.T) {
sqlServerIdleTime := resolveSQLConnectionPoolMaxIdleTime("sqlserver")
if sqlServerIdleTime <= defaultSQLConnMaxIdleTime {