Skip to content

Commit 4e563a8

Browse files
committed
bb8: add comment about cancellation safety
1 parent 6ca2efc commit 4e563a8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bb8/src/inner.rs

+4
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ where
8989
loop {
9090
let (conn, approvals) = self.inner.pop();
9191
self.spawn_replenishing_approvals(approvals);
92+
93+
// Cancellation safety: make sure to wrap the connection in a `PooledConnection`
94+
// before allowing the code to hit an `await`, so we don't lose the connection.
95+
9296
let mut conn = match conn {
9397
Some(conn) => PooledConnection::new(self, conn),
9498
None => {

0 commit comments

Comments
 (0)