Fokko commented on code in PR #3063:
URL: https://github.com/apache/iceberg-python/pull/3063#discussion_r2835001450


##########
pyiceberg/catalog/rest/__init__.py:
##########
@@ -685,12 +697,27 @@ def _init_sigv4(self, session: Session) -> None:
         from botocore.awsrequest import AWSRequest
         from requests import PreparedRequest
         from requests.adapters import HTTPAdapter
+        from urllib3.util.retry import Retry
 
         class SigV4Adapter(HTTPAdapter):
             def __init__(self, **properties: str):
-                super().__init__()
                 self._properties = properties
+                max_retries = property_as_int(self._properties, 
SIGV4_MAX_RETRIES, SIGV4_DEFAULT_MAX_RETRIES)
+                super().__init__(
+                    max_retries=Retry(
+                        total=max_retries,
+                        status=max_retries,
+                        connect=max_retries,
+                        read=max_retries,
+                        # Keep retries conservative for idempotent calls.
+                        allowed_methods=frozenset({"GET", "HEAD", "OPTIONS"}),
+                        status_forcelist=SIGV4_RETRY_STATUS_CODES,
+                        backoff_factor=SIGV4_RETRY_BACKOFF_FACTOR,
+                        respect_retry_after_header=True,
+                    )
+                )

Review Comment:
   I think a lot of the options are not needed, why not just set the number of 
retries:
   ```suggestion
                   super().__init__(
                       max_retries=max_retries
                   )
   ```
   Exponential backoff is very tricky in SigV4 since it is a critical path in 
terms of performance.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to