Hi, small modification of retain function can lead to dead-lock.
let interval = Duration::from_secs(30);
let max_age = Duration::from_secs(60);
tokio::spawn(async move {
loop {
tokio::time::sleep(interval).await;
pool.retain(|_, metrics| {
let should_be_remove = pool.status().size > 1 && metrics.last_used() > max_age;
!should_be_removed
});
}
});
Above calls self.inner.slots.lock().unwrap() twice in retain function because status() also blocks. The easiest way would be to make status lock-free. Status is already documented as not consistent so I think it should be possible to achieve.
Hi, small modification of retain function can lead to dead-lock.
Above calls
self.inner.slots.lock().unwrap()twice in retain function because status() also blocks. The easiest way would be to make status lock-free. Status is already documented as not consistent so I think it should be possible to achieve.