Shawnsuun commented on code in PR #74382:
URL: https://github.com/apache/airflow/pull/74382#discussion_r4404445343


##########
airflow-ctl/src/airflowctl/ctl/cli_config.py:
##########
@@ -66,6 +66,25 @@ def command(*args, **kwargs):
     return command
 
 
+_WRITE_METHODS = frozenset({"POST", "PUT", "PATCH", "DELETE"})
+
+
+def _warn_if_write_may_have_applied(error: httpx.HTTPError) -> None:
+    """Warn that a failed write is not retried because the server may already 
have applied it."""
+    if isinstance(error, httpx.HTTPStatusError) and error.response.status_code 
< 500:
+        return
+    try:
+        method = error.request.method

Review Comment:
   Good point, thanks. Moved it into `_request_method()` in `client.py`, which 
returns `None` when httpx has no request to attach, and both 
`_should_retry_api_request` and `_warn_if_write_may_have_applied` use it now. 
Behaviour is unchanged; I added a small test for the helper.



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