Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(query): avoid retrying local query timeouts

t8y208fb5bbf4def
diff --git a/crates/dbx-core/src/query.rs b/crates/dbx-core/src/query.rs
index 86b5c03c59..1aa7806eeb 100644
--- a/crates/dbx-core/src/query.rs
+++ b/crates/dbx-core/src/query.rs
@@ -572,6 +572,9 @@ pub fn agent_close_query_session_params(session_id: &str) -> serde_json::Value {
pub fn is_connection_error(err: &str) -> bool {
let lower = err.to_lowercase();
+ if is_dbx_query_timeout_error(&lower) {
+ return false;
+ }
lower.contains("connection")
|| lower.contains("broken pipe")
|| lower.contains("reset by peer")
@@ -588,6 +591,10 @@ pub fn is_connection_error(err: &str) -> bool {
|| is_os_connection_error(&lower)
}
+fn is_dbx_query_timeout_error(lower: &str) -> bool {
+ lower.starts_with("query timed out after ")
+}
+
fn is_os_connection_error(lower: &str) -> bool {
let os_error_codes = ["10053", "10054", "10057", "10058", "10060", "10061"];
if let Some(pos) = lower.find("os error ") {
@@ -1823,6 +1830,7 @@ mod tests {
#[test]
fn is_connection_error_rejects_non_connection_errors() {
+ assert!(!is_connection_error("Query timed out after 30 seconds"));
assert!(!is_connection_error("ORA-00942: table or view does not exist"));
assert!(!is_connection_error("syntax error at position 5"));
assert!(!is_connection_error("os error 13"));