perf(execution): prewarm tab session pools and report perceived wait
This commit is contained in:
17 files changed
+558
-29
No files matched your search
@@ -389,6 +389,7 @@ async fn main() {
|
||||
.route("/connection/final-proxy-port", post(routes::connection::connection_final_proxy_port))
|
||||
.route("/connection/disconnect", post(routes::connection::disconnect_db))
|
||||
.route("/connection/check-health", post(routes::connection::check_connection_health))
|
||||
.route("/connection/prewarm", post(routes::connection::prewarm_connection))
|
||||
.route("/connection/session-credential-status", post(routes::connection::session_credential_status))
|
||||
.route("/connection/forget-session-credential", post(routes::connection::forget_session_credential))
|
||||
.route(
|
||||
|
||||
@@ -106,6 +106,15 @@ pub struct DisconnectRequest {
|
||||
pub client_attempt: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PrewarmConnectionRequest {
|
||||
pub connection_id: String,
|
||||
pub database: Option<String>,
|
||||
pub catalog: Option<String>,
|
||||
pub client_session_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CloseDatabaseConnectionRequest {
|
||||
@@ -602,6 +611,21 @@ pub async fn check_connection_health(
|
||||
Ok(Json(()))
|
||||
}
|
||||
|
||||
pub async fn prewarm_connection(
|
||||
State(state): State<Arc<WebState>>,
|
||||
Json(body): Json<PrewarmConnectionRequest>,
|
||||
) -> Result<Json<()>, AppError> {
|
||||
let database = body.database.as_deref().filter(|value| !value.is_empty());
|
||||
let catalog = body.catalog.as_deref().filter(|value| !value.is_empty());
|
||||
let client_session_id = body.client_session_id.as_deref().filter(|value| !value.is_empty());
|
||||
state
|
||||
.app
|
||||
.prewarm_connection_pool(&body.connection_id, database, catalog, client_session_id)
|
||||
.await
|
||||
.map_err(AppError::from)?;
|
||||
Ok(Json(()))
|
||||
}
|
||||
|
||||
/// 查询连接在本次运行期是否已输入并暂存密码(`save_password=false`)。
|
||||
/// 供前端决定是否需要弹密码框;仅返回布尔状态,不泄露密码本身。
|
||||
/// 按当前登录会话(owner)查询,不会暴露其他会话的凭据状态。
|
||||
|
||||
Reference in new issue
Block a user