close pool if exists

pull/3/head
Takayuki Maeda 3 years ago
parent 2c3f6a2076
commit d6ed5f976c

@ -4,7 +4,9 @@ use sqlx::mysql::MySqlPool;
pub async fn handler(_key: Key, app: &mut App) -> anyhow::Result<()> {
if let Some(conn) = app.selected_connection() {
app.pool.as_ref().unwrap().close().await;
if let Some(pool) = app.pool.as_ref() {
pool.close().await;
}
let pool = MySqlPool::connect(conn.database_url().as_str()).await?;
app.pool = Some(pool);
app.focus_type = FocusType::Dabatases(true);

Loading…
Cancel
Save