Skip to content

Commit

Permalink
bb8: add comment about cancellation safety
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Feb 1, 2024
1 parent 6ca2efc commit cb08f91
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bb8/src/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ where
loop {
let (conn, approvals) = self.inner.pop();
self.spawn_replenishing_approvals(approvals);

// Cancellation safety: make sure to wrap the connection in a `PooledConnection`
// before allowing the code to hit an `await`, so we don't lose the connection.

let mut conn = match conn {
Some(conn) => PooledConnection::new(self, conn),
None => {
Expand Down

0 comments on commit cb08f91

Please sign in to comment.