amoghrajesh commented on code in PR #56762:
URL: https://github.com/apache/airflow/pull/56762#discussion_r2454168668


##########
task-sdk/src/airflow/sdk/api/client.py:
##########
@@ -812,6 +817,14 @@ def noop_handler(request: httpx.Request) -> httpx.Response:
 API_SSL_CERT_PATH = conf.get("api", "ssl_cert")
 
 
+def _should_retry_api_request(exception: BaseException) -> bool:
+    """Determine if an API request should be retried based on the exception 
type."""
+    if isinstance(exception, httpx.HTTPStatusError):
+        return exception.response.status_code >= 500

Review Comment:
   Ran a simple script for checking difference:
   
   Testing _should_retry_api_request:
   ✅ HTTPStatusError: True (expected True)
   ✅ HTTPStatusError: True (expected True)
   ✅ HTTPStatusError: True (expected True)
   ✅ HTTPStatusError: False (expected False)
   ✅ HTTPStatusError: False (expected False)
   ✅ HTTPStatusError: False (expected False)
   ✅ HTTPStatusError: False (expected False)
   ✅ ConnectError: True (expected True)
   ✅ ReadTimeout: True (expected True)
   ✅ WriteError: True (expected True)
   ✅ ProxyError: True (expected True)
   ✅ ValueError: False (expected False)
   ✅ RuntimeError: False (expected False)



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

Reply via email to