Skip to content

Commit

Permalink
Move reap() logic into SharedPool
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Jan 29, 2024
1 parent 4c2ea49 commit d86015e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 1 addition & 4 deletions bb8/src/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,7 @@ impl<M: ManageConnection> Reaper<M> {
None => break,
};

let mut locked = pool.inner.internals.lock();
let approvals = locked.reap(&pool.inner.statics);
drop(locked);

let approvals = pool.inner.reap();
pool.spawn_replenishing_approvals(approvals);
}
}
Expand Down
5 changes: 5 additions & 0 deletions bb8/src/internals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ where
(conn, approvals)
}

pub(crate) fn reap(&self) -> ApprovalIter {
let mut locked = self.internals.lock();
locked.reap(&self.statics)
}

pub(crate) fn forward_error(&self, err: M::Error) {
self.statics.error_sink.sink(err);
}
Expand Down

0 comments on commit d86015e

Please sign in to comment.