fix(query): recover expired manual transaction sessions
This commit is contained in:
15 files changed
+252
-24
No files matched your search
@@ -23,6 +23,13 @@ struct ExecuteMultiProgress {
|
||||
error: Option<BackendError>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ManualTransactionCommandError {
|
||||
Structured(BackendError),
|
||||
Legacy(String),
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn execute_query(
|
||||
@@ -456,7 +463,7 @@ pub async fn execute_in_manual_transaction(
|
||||
schema: Option<String>,
|
||||
max_rows: Option<usize>,
|
||||
table_data_preview: Option<bool>,
|
||||
) -> Result<Vec<dbx_core::query::ExecuteMultiResult>, String> {
|
||||
) -> Result<Vec<dbx_core::query::ExecuteMultiResult>, ManualTransactionCommandError> {
|
||||
dbx_core::query::execute_in_manual_transaction_with_options(
|
||||
&state,
|
||||
&txn_session_id,
|
||||
@@ -467,6 +474,15 @@ pub async fn execute_in_manual_transaction(
|
||||
table_data_preview.unwrap_or(false),
|
||||
)
|
||||
.await
|
||||
.map_err(|error| {
|
||||
if dbx_core::query::is_manual_transaction_session_expired_error(&error) {
|
||||
ManualTransactionCommandError::Structured(BackendError::from_manual_transaction_session_expired(
|
||||
dbx_core::query::MANUAL_TRANSACTION_IDLE_TIMEOUT_SECS,
|
||||
))
|
||||
} else {
|
||||
ManualTransactionCommandError::Legacy(error)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
|
||||
Reference in new issue
Block a user