From e2c707b44782c7bd09f60f23a0a4cadc80bb8c80 Mon Sep 17 00:00:00 2001 From: Austin Bonander Date: Wed, 1 Jul 2020 14:34:45 -0700 Subject: [PATCH] fix: make `Pool::try_acquire()` fair only when `fair=true` in the options --- sqlx-core/src/pool/inner.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlx-core/src/pool/inner.rs b/sqlx-core/src/pool/inner.rs index 80afd897..761e6d28 100644 --- a/sqlx-core/src/pool/inner.rs +++ b/sqlx-core/src/pool/inner.rs @@ -66,7 +66,7 @@ impl SharedPool { #[inline] pub(super) fn try_acquire(&self) -> Option>> { // 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())