From b188c8371710b8c2eb933bb42d7f9c9a6fd4f74f Mon Sep 17 00:00:00 2001 From: Andrew Whitehead Date: Thu, 17 Dec 2020 22:02:08 -0800 Subject: [PATCH] manually close connections in SharedPool::close --- sqlx-core/src/pool/inner.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sqlx-core/src/pool/inner.rs b/sqlx-core/src/pool/inner.rs index aef5983e8a..8e1286597d 100644 --- a/sqlx-core/src/pool/inner.rs +++ b/sqlx-core/src/pool/inner.rs @@ -47,10 +47,11 @@ impl SharedPool { // ensure we wait until the pool is actually closed while self.size() > 0 { - let _ = self - .idle_conns - .pop() - .map(|idle| Floating::from_idle(idle, self)); + if let Ok(idle) = self.idle_conns.pop() { + if let Err(e) = Floating::from_idle(idle, self).close().await { + log::warn!("error occurred while closing the pool connection: {}", e); + } + } // yield to avoid starving the executor sqlx_rt::yield_now().await;