Skip to content

STL-2767: Retry on HTTP 429 with Retry-After support#1631

Open
roman-kiselevich wants to merge 1 commit into
masterfrom
rkis/STL-2767-retry-on-429
Open

STL-2767: Retry on HTTP 429 with Retry-After support#1631
roman-kiselevich wants to merge 1 commit into
masterfrom
rkis/STL-2767-retry-on-429

Conversation

@roman-kiselevich
Copy link
Copy Markdown

@roman-kiselevich roman-kiselevich commented May 26, 2026

Problem

The public rate limits for the metadata-api provisioning APIs (STL-2767) are now rolled out in gitops-panther. The gateway responds with HTTP 429 and a Retry-After header when a limit is exceeded, but the Python SDK has no retry handling — every 429 surfaces as an ApiException to the caller.

Summary

Adds GoodDataApiClientRetryConfig and applies the same urllib3.Retry policy to both transport paths:

  • The generated gooddata-api-client — via Configuration.retries.
  • The direct requests.post in GoodDataApiClient._do_post_request — via a Session with HTTPAdapter mounted using the same Retry object.

Defaults: 10 retries on 429 across GET/HEAD/OPTIONS/TRACE/POST/PUT/PATCH/DELETE, backoff_factor=0.5, backoff_max=60s. Retry-After is honoured automatically by urllib3 when present; backoff only applies when the server omits the header.

The config is exposed at the top level (from gooddata_sdk import GoodDataApiClientRetryConfig) and accepted by both GoodDataApiClient.__init__ and GoodDataSdk.create.

Reasoning

The retry policy lives in the hand-written SDK wrapper (packages/gooddata-sdk/src/gooddata_sdk/client.py) rather than in the auto-generated gooddata-api-client/, because the latter is regenerated from OpenAPI templates and any direct edits would be overwritten. Configuration.retries is the documented hook the generator exposes for exactly this purpose.

POST/PUT/PATCH/DELETE are included in allowed_methods because the rate-limited endpoints are provisioning calls — retrying them is safe since the gateway returns 429 before the request is processed.

@roman-kiselevich roman-kiselevich marked this pull request as draft May 26, 2026 14:26
@roman-kiselevich roman-kiselevich force-pushed the rkis/STL-2767-retry-on-429 branch 2 times, most recently from b298892 to 778ba64 Compare May 26, 2026 14:43
Adds GoodDataApiClientRetryConfig, applied to both the generated
api-client (via Configuration.retries) and the direct requests.post
in _do_post_request (via a Session with HTTPAdapter). Defaults: 10
retries on 429, backoff_factor=0.5, backoff_max=60s; Retry-After
honoured automatically.

jira: STL-2767
risk: low
@roman-kiselevich roman-kiselevich force-pushed the rkis/STL-2767-retry-on-429 branch from 778ba64 to a191652 Compare May 26, 2026 14:57
@roman-kiselevich roman-kiselevich marked this pull request as ready for review May 26, 2026 15:03
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