Skip to content

Commit

Permalink
Use the permit in send_retry
Browse files Browse the repository at this point in the history
  • Loading branch information
hesampakdaman committed May 27, 2024
1 parent 8b3bbf0 commit ee03292
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion object_store/src/azure/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,6 @@ mod tests {
use super::*;
use crate::azure::MicrosoftAzureBuilder;
use crate::client::mock_server::MockServer;
use crate::RetryConfig;
use crate::{ObjectStore, Path};

#[tokio::test]
Expand Down
8 changes: 7 additions & 1 deletion object_store/src/client/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,13 @@ impl RetryExt for reqwest::RequestBuilder {

fn send_retry(self, ctx: &RequestContext) -> BoxFuture<'static, Result<Response>> {
let request = self.retryable(&ctx.config);
Box::pin(async move { request.send().await })
let semaphore = Arc::clone(&ctx.semaphore);
Box::pin(async move {
let permit = semaphore.acquire_owned().await.unwrap();
let response = request.send().await;
drop(permit);
response
})
}
}

Expand Down

0 comments on commit ee03292

Please sign in to comment.