fix: release duckdb session locks on pool close

This commit is contained in:
t8y2 committed 2026-05-29 00:16:37 +08:00
1 parent f8ade78e97
commit a1e00fcf1a
2 files changed
+69 -25

No files matched your search

+1 -21
View File
@@ -504,27 +504,7 @@ pub async fn disconnect_db(state: State<'_, Arc<AppState>>, connection_id: Strin
conns.keys().filter(|k| *k == &connection_id || k.starts_with(&format!("{connection_id}:"))).cloned().collect();
for key in keys_to_remove {
if let Some(pool) = conns.remove(&key) {
match pool {
PoolKind::Mysql(p, _) => {
let _ = p.disconnect().await;
}
PoolKind::Postgres(p) => p.close(),
PoolKind::Sqlite(_) => {}
PoolKind::Redis(_) => {}
PoolKind::DuckDb(con) => {
dbx_core::db::duckdb_driver::close_connection(con);
}
PoolKind::MongoDb(_) => {}
PoolKind::ClickHouse(_) => {}
PoolKind::SqlServer(_) => {}
PoolKind::Elasticsearch(_) => {}
PoolKind::Agent(client) => {
let mut client = client.lock().await;
let _ = client.disconnect().await;
}
PoolKind::ExternalTabular(_) => {}
PoolKind::ExternalDriver { .. } => {}
}
dbx_core::connection::close_pool_kind(pool).await;
}
}
drop(conns);