hesampakdaman commented on code in PR #5806:
URL: https://github.com/apache/arrow-rs/pull/5806#discussion_r1617596342
##########
object_store/src/client/retry.rs:
##########
@@ -368,21 +399,29 @@ impl RetryExt for reqwest::RequestBuilder {
}
}
- fn send_retry(self, config: &RetryConfig) -> BoxFuture<'static,
Result<Response>> {
- let request = self.retryable(config);
- Box::pin(async move { request.send().await })
+ fn send_retry(self, ctx: &RequestContext) -> BoxFuture<'static,
Result<Response>> {
+ let request = self.retryable(&ctx.config);
+ let semaphore = Arc::clone(&ctx.semaphore);
+ Box::pin(async move {
+ let permit = semaphore.acquire_owned().await.unwrap();
Review Comment:
Should we let `RetryableRequest` hold `Arc<Semaphore>`
```diff
RetryableRequest {
...
+ sempahore: Arc::clone(&ctx.semaphore),
}
```
and then in the `loop` for `RetryableRequest.send` `acquire` the permit and
explicitly drop it in an Err(..) arm?
```diff
loop {
+ let permit = self.semaphore.acquire().await.expect("Semaphore
acquisition failed");
+
let mut request = self
.request
.try_clone()
@@ -269,6 +273,7 @@ impl RetryableRequest {
};
}
Err(e) => {
+ drop(permit);
let status = r.status();
if retries == max_retries
|| now.elapsed() > retry_timeout
@@ -311,6 +316,7 @@ impl RetryableRequest {
}
},
Err(e) => {
+ drop(permit);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]