fix: make Pool::try_acquire() fair only when fair=true in the options

This commit is contained in:
Austin Bonander 2020-07-01 14:34:45 -07:00 committed by Ryan Leckey
parent 15e0a5553a
commit e2c707b447

View file

@ -66,7 +66,7 @@ impl<DB: Database> SharedPool<DB> {
#[inline]
pub(super) fn try_acquire(&self) -> Option<Floating<'_, Live<DB>>> {
// don't cut in line
if !self.waiters.is_empty() {
if self.options.fair && !self.waiters.is_empty() {
return None;
}
Some(self.pop_idle()?.into_live())