mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-29 08:11:06 +00:00
perf(agent): reuse daemon process for test_connection to avoid JVM cold start
Keep a per-db-type daemon agent process alive in AgentManager. test_connection now reuses the warm daemon instead of spawning a new JVM each time. If the daemon dies, it auto-respawns on next call.
This commit is contained in:
@@ -113,9 +113,10 @@ pub async fn test_connection(state: State<'_, Arc<AppState>>, config: Connection
|
||||
db::elasticsearch_driver::test_connection(&client).await.map(|_| "Connection successful".to_string())
|
||||
}
|
||||
DatabaseType::Dameng | DatabaseType::Kingbase | DatabaseType::Vastbase | DatabaseType::Goldendb => {
|
||||
let mut client = state.agent_manager.spawn(&config.db_type).await?;
|
||||
client
|
||||
.call::<serde_json::Value>(
|
||||
state
|
||||
.agent_manager
|
||||
.call_daemon::<serde_json::Value>(
|
||||
&config.db_type,
|
||||
"test_connection",
|
||||
serde_json::json!({
|
||||
"host": host,
|
||||
|
||||
Reference in New Issue
Block a user