Merge stable into develop - #1333
Merged
Merged
Conversation
retry_on_failure only covered connection errors inside execute_graphql, gave up after max_retry_duration, spun without delay on HTTP 5xx, and never looked at REST calls or at GraphQL error envelopes, so a generator running for hours aborted on the first transient infrastructure error. A TransientRetryHandler now drives every request path of both clients: GraphQL queries and mutations, REST endpoints such as query_gql_query and schema loading, multipart uploads and streamed downloads. It retries connection errors, connections dropped before a response arrives (the shape a load balancer failover takes on an in-flight request), every httpx timeout, HTTP 500/502/503/504 responses and GraphQL envelopes whose errors all carry one of those statuses, sharing one time budget and attempt counter across the transport and envelope layers. Anything else still fails fast. Retries use exponential backoff with jitter from retry_delay up to the new retry_max_delay; a zero for either is rejected since it would turn every retry into a tight loop. retry_status_codes tunes which statuses count as transient, and max_retry_duration=0 retries indefinitely. Each retry is logged with its attempt number and elapsed time, escalating from WARNING to ERROR after five minutes, and once the budget is spent the original error is raised. retry_on_failure and retry_delay are properties so they can be toggled at runtime. Uploads from a stream that cannot be rewound are copied once to a temporary file, off the event loop in the async client, so a retried send carries the full body. A streamed download whose connection drops mid-body raises ServerNotResponsiveError, is restarted on the shared budget by the file handler, and never leaves a partial file behind. Opt-in integration tests (INFRAHUB_TESTING_FAILOVER=1) restart HAProxy and the API servers mid-mutation against a real deployment. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Deploying infrahub-sdk-python with
|
| Latest commit: |
d3ad29e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://140aa951.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://fac-prep-1-23-2-hecha.infrahub-sdk-python.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merging stable into develop after merging pull request #1323.
Summary by cubic
Retries transient failures on every SDK request path when
retry_on_failureis enabled, so long-running scripts and generators no longer abort on temporary Infrahub outages. Previously only connection errors inexecute_graphqlwere retried; now dropped connections, timeouts, HTTP500/502/503/504responses, and transient GraphQL errors are retried with exponential backoff and jitter.retry_max_delayandretry_status_codes;max_retry_duration=0retries indefinitely.Migration
retry_delaymust now be greater than 0; configuring 0 is rejected.Written for commit ff7a597. Summary will update on new commits.