manually close connections in SharedPool::close

This commit is contained in:
Andrew Whitehead 2020-12-17 22:02:08 -08:00 committed by Ryan Leckey
parent f39d194b17
commit a445f9f431
No known key found for this signature in database
GPG Key ID: F8AA68C235AB08C9

View File

@ -47,10 +47,11 @@ impl<DB: Database> SharedPool<DB> {
// 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;