Skip to content

Commit 99c5b81

Browse files
committed
fix: continue on errors when closing conns
1 parent ee4c38b commit 99c5b81

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/commands.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,18 @@ pub async fn close_all(db_instances: State<'_, DbInstances>) -> Result<()> {
264264
// Collect all wrappers to close
265265
let wrappers: Vec<DatabaseWrapper> = instances.drain().map(|(_, v)| v).collect();
266266

267-
// Close each connection
267+
// Close each connection, continuing on errors to ensure all get closed
268+
let mut last_error = None;
268269
for wrapper in wrappers {
269-
wrapper.close().await?;
270+
if let Err(e) = wrapper.close().await {
271+
last_error = Some(e);
272+
}
270273
}
271274

272-
Ok(())
275+
match last_error {
276+
Some(e) => Err(e),
277+
None => Ok(()),
278+
}
273279
}
274280

275281
/// Close database connection and remove all database files

0 commit comments

Comments
 (0)