From 4fe4dab38506496f2ca4ec41ff20c2b98134fadd Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 21 Nov 2023 23:53:16 -0400 Subject: [PATCH] skip biased semaphore --- web3_proxy/src/frontend/authorization.rs | 46 +++++++++++++----------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/web3_proxy/src/frontend/authorization.rs b/web3_proxy/src/frontend/authorization.rs index 97fb19d3..18ae8417 100644 --- a/web3_proxy/src/frontend/authorization.rs +++ b/web3_proxy/src/frontend/authorization.rs @@ -551,16 +551,18 @@ impl App { }) .await; - let semaphore_permit = tokio::select! { - biased; + let semaphore_permit = semaphore.acquire_owned().await?; - p = semaphore.acquire_owned() => { - p - } - p = self.bonus_ip_concurrency.clone().acquire_owned() => { - p - } - }?; + // let semaphore_permit = tokio::select! { + // biased; + + // p = semaphore.acquire_owned() => { + // p + // } + // p = self.bonus_ip_concurrency.clone().acquire_owned() => { + // p + // } + // }?; Ok(Some(semaphore_permit)) } else { @@ -590,19 +592,21 @@ impl App { }) .await; - let semaphore_permit = tokio::select! { - biased; + let semaphore_permit = semaphore.acquire_owned().await?; - p = semaphore.acquire_owned() => { - p - } - p = self.bonus_user_concurrency.clone().acquire_owned() => { - p - } - p = self.bonus_ip_concurrency.clone().acquire_owned() => { - p - } - }?; + // let semaphore_permit = tokio::select! { + // biased; + + // p = semaphore.acquire_owned() => { + // p + // } + // p = self.bonus_user_concurrency.clone().acquire_owned() => { + // p + // } + // p = self.bonus_ip_concurrency.clone().acquire_owned() => { + // p + // } + // }?; Ok(Some(semaphore_permit)) } else {