Skip to content

Commit ea1f24d

Browse files
committed
fix: add users when a waiter comes
Signed-off-by: tison <wander4096@gmail.com>
1 parent c473e3f commit ea1f24d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fastpool/src/bounded.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,13 @@ impl<M: ManageObject> Pool<M> {
201201
/// maximum size, this method would block until an object is returned to the pool or an object
202202
/// is detached from the pool.
203203
pub async fn get(self: &Arc<Self>) -> Result<Object<M>, M::Error> {
204-
let permit = self.permits.clone().acquire_owned(1).await;
205-
206204
self.users.fetch_add(1, Ordering::Relaxed);
207205
let guard = scopeguard::guard((), |()| {
208206
self.users.fetch_sub(1, Ordering::Relaxed);
209207
});
210208

209+
let permit = self.permits.clone().acquire_owned(1).await;
210+
211211
let object = loop {
212212
let existing = match self.config.queue_strategy {
213213
QueueStrategy::Fifo => self.slots.lock().deque.pop_front(),

0 commit comments

Comments
 (0)