Skip to content

Commit

Permalink
manually close connections in SharedPool::close
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewwhitehead authored and abonander committed Dec 18, 2020
1 parent 07fd531 commit b188c83
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sqlx-core/src/pool/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b188c83

Please sign in to comment.