This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs-object-store.git
The following commit(s) were added to refs/heads/main by this push:
new 0478be4 feat: retry on 429 and 408 (#426)
0478be4 is described below
commit 0478be4c12ca11787e7eb404983cae5d86e92efb
Author: Chris <[email protected]>
AuthorDate: Tue Jul 8 00:11:41 2025 -0700
feat: retry on 429 and 408 (#426)
---
src/client/retry.rs | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/client/retry.rs b/src/client/retry.rs
index d33e1e9..9eac2b1 100644
--- a/src/client/retry.rs
+++ b/src/client/retry.rs
@@ -403,6 +403,7 @@ impl RetryableRequest {
if ctx.exhausted()
|| !(status.is_server_error()
|| status == StatusCode::TOO_MANY_REQUESTS
+ || status == StatusCode::REQUEST_TIMEOUT
|| (self.retry_on_conflict && status ==
StatusCode::CONFLICT))
{
let source = match status.is_client_error() {
@@ -594,6 +595,28 @@ mod tests {
let r = do_request().await.unwrap();
assert_eq!(r.status(), StatusCode::OK);
+ // Should retry 429 Too Many Requests
+ mock.push(
+ Response::builder()
+ .status(StatusCode::TOO_MANY_REQUESTS)
+ .body(String::new())
+ .unwrap(),
+ );
+
+ let r = do_request().await.unwrap();
+ assert_eq!(r.status(), StatusCode::OK);
+
+ // Should retry 408 Request Timeout
+ mock.push(
+ Response::builder()
+ .status(StatusCode::REQUEST_TIMEOUT)
+ .body(String::new())
+ .unwrap(),
+ );
+
+ let r = do_request().await.unwrap();
+ assert_eq!(r.status(), StatusCode::OK);
+
// Accepts 204 status code
mock.push(
Response::builder()