Skip to content

Commit

Permalink
Simplify reaper setup
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Jan 29, 2024
1 parent 2699ff6 commit 9911e8e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions bb8/src/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ where
let inner = Arc::new(SharedPool::new(builder, manager));

if inner.statics.max_lifetime.is_some() || inner.statics.idle_timeout.is_some() {
let s = Arc::downgrade(&inner);
if let Some(shared) = s.upgrade() {
let start = Instant::now() + shared.statics.reaper_rate;
let interval = interval_at(start.into(), shared.statics.reaper_rate);
schedule_reaping(interval, s);
}
let start = Instant::now() + inner.statics.reaper_rate;
let interval = interval_at(start.into(), inner.statics.reaper_rate);
schedule_reaping(interval, Arc::downgrade(&inner));
}

Self { inner }
Expand Down

0 comments on commit 9911e8e

Please sign in to comment.