fix(sidebar): keep destructive table operations cancellable

This commit is contained in:
Melody Ruch authored and GitHub committed 2026-08-20 15:14:45 +08:00
1 parent dd77817c7e
commit 89e0f1734b
20 files changed
+627 -25

No files matched your search

+15 -3
View File
@@ -51,7 +51,7 @@ pub async fn execute_query(
});
let cancel_token = registered_query.as_ref().map(|query| query.token());
dbx_core::query::execute_sql_statement_with_options_typed(
let result = dbx_core::query::execute_sql_statement_with_options_typed(
&state,
&connection_id,
&database,
@@ -72,8 +72,20 @@ pub async fn execute_query(
..Default::default()
},
)
.await
.map_err(dbx_core::query::QueryExecutionError::into_backend_error)
.await;
if matches!(result, Err(dbx_core::query::QueryExecutionError::Timeout(_))) {
// We're giving up on waiting, not cancelling: the statement may
// still be executing server-side. Keep the registration (and any
// KILL-QUERY-style interrupt registered against it) reachable so a
// later explicit cancel_query call can still reach it, instead of
// losing that capability the instant this command returns.
if let Some(registered_query) = registered_query {
registered_query.detach();
}
}
result.map_err(dbx_core::query::QueryExecutionError::into_backend_error)
}
#[tauri::command]