From 8795cbe407fb40c525985d88779bbd4081e6d9ca Mon Sep 17 00:00:00 2001 From: Andy Duplain Date: Wed, 20 May 2026 09:28:38 +0100 Subject: [PATCH] It's not an error if we cannot close the database files. --- nym-sqlx-pool-guard/src/lib.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/nym-sqlx-pool-guard/src/lib.rs b/nym-sqlx-pool-guard/src/lib.rs index a66a0b9167..d1b3808bd9 100644 --- a/nym-sqlx-pool-guard/src/lib.rs +++ b/nym-sqlx-pool-guard/src/lib.rs @@ -88,9 +88,23 @@ impl SqlitePoolGuard { async fn close_pool_inner(&self) -> std::io::Result<()> { self.inner.connection_pool.close().await; - self.wait_for_db_files_close().await.inspect_err(|e| { - tracing::error!("Failed to wait for file to close: {e}"); - }) + if let Err(e) = self.wait_for_db_files_close().await { + if e.kind() == std::io::ErrorKind::TimedOut { + tracing::warn!( + "Timed out waiting for OS file handles for sqlite database to be released; \ + another connection to the same file may still be open. Path = {}", + self.inner.database_path.display() + ); + } else { + tracing::warn!( + "Failed to wait for sqlite database file handles to be released: Path = {}. Error = {}", + self.inner.database_path.display(), + e + ); + } + } + + Ok(()) } /// Returns all database files, including shm and wal files.