diff --git a/bb8/src/inner.rs b/bb8/src/inner.rs index c0478ab..7f22516 100644 --- a/bb8/src/inner.rs +++ b/bb8/src/inner.rs @@ -237,10 +237,7 @@ impl Reaper { 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); } } diff --git a/bb8/src/internals.rs b/bb8/src/internals.rs index 8d6585c..9794453 100644 --- a/bb8/src/internals.rs +++ b/bb8/src/internals.rs @@ -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); }