From 6dd2f16df14aa6fa717e6ddbb4e8065e9b7a4e14 Mon Sep 17 00:00:00 2001 From: link2xt Date: Mon, 29 Jul 2024 21:52:02 +0000 Subject: [PATCH] fix: explicitly close the database on account removal --- src/accounts.rs | 1 + src/sql.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/accounts.rs b/src/accounts.rs index 4e6b403ff..a778eb681 100644 --- a/src/accounts.rs +++ b/src/accounts.rs @@ -165,6 +165,7 @@ impl Accounts { .remove(&id) .with_context(|| format!("no account with id {id}"))?; ctx.stop_io().await; + ctx.sql.close().await; drop(ctx); if let Some(cfg) = self.config.get_account(id) { diff --git a/src/sql.rs b/src/sql.rs index 841325e31..06c52708a 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -126,7 +126,7 @@ impl Sql { } /// Closes all underlying Sqlite connections. - async fn close(&self) { + pub(crate) async fn close(&self) { let _ = self.pool.write().await.take(); // drop closes the connection }