Skip to content

fix: handle HTTP 429 responses missing the Retry-After header - #90

Open
ayeshurun wants to merge 1 commit into
mainfrom
dev/alonyeshurun/dataflow-create-retry-after
Open

fix: handle HTTP 429 responses missing the Retry-After header#90
ayeshurun wants to merge 1 commit into
mainfrom
dev/alonyeshurun/dataflow-create-retry-after

Conversation

@ayeshurun

Copy link
Copy Markdown
Owner

✨ Description of new changes

Summary: Fixes fab create ... f.dataflow (and other long-running operations) failing with x [UnexpectedError] retry-after.

Context: When Fabric throttles a request but returns an HTTP 429 without a Retry-After header, the rate-limit handler in fab_api_client.py read the header via direct subscript (response.headers["Retry-After"]). Because requests' CaseInsensitiveDict lowercases keys, this raised KeyError("retry-after"). That error was not caught by the requests.RequestException handler, so it bubbled up to main.py and surfaced as [UnexpectedError] retry-after. Creating a dataflow is a long-running, polling operation that is especially prone to hitting throttling, which is why it reproduced there.

The fix reuses the existing get_polling_interval() helper, which reads the retry-after header case-insensitively and falls back to the default polling interval (10s) when the header is missing or non-numeric. This makes the client resilient to throttled 429s and lets it retry as intended instead of erroring out.

Dependencies: None.

Testing

  • Added regression test test_do_request_429_without_retry_after_header_retries_with_default_interval, verified it reproduces the KeyError on the old code and passes on the fix.
  • Existing api client and polling utils tests pass (52 tests); black and mypy clean.
  • Added a changie fixed entry.

Creating a dataflow (and other long-running, throttling-prone
operations) could fail with "[UnexpectedError] retry-after" when
Fabric returned a 429 without a Retry-After header. The 429 handler
read the header via direct subscript, raising a KeyError that escaped
the request exception handler and surfaced as an unexpected error.

Use the existing get_polling_interval helper, which reads the header
case-insensitively and falls back to the default polling interval when
it is missing or non-numeric.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a4b6c3e7-7425-4fa7-9f0a-ac7e87377ee2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant