feat(proxy): resilient relay retries with per-host adaptive cooldown#33
Open
mehrad-mz wants to merge 1 commit intomasterking32:python_testingfrom
Open
feat(proxy): resilient relay retries with per-host adaptive cooldown#33mehrad-mz wants to merge 1 commit intomasterking32:python_testingfrom
mehrad-mz wants to merge 1 commit intomasterking32:python_testingfrom
Conversation
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.
Summary
Improves reliability when the Apps Script relay returns transient failures (e.g. short-lived throttling / overload). The proxy now retries safe idempotent requests and applies per-host back-pressure so burst traffic (many sequential GETs, like image galleries) is less likely to trigger repeated failures.
Motivation
Users observed intermittent
502responses from the local relay path that often succeed on a quick manual refresh. Sequential downloads amplified the issue due to request bursts hitting the same host.What changed
_relay_smart_with_transient_retry()so_relay_smart()behavior is preserved, with an outer retry/cooldown layer.GET,HEAD,OPTIONS) and empty bodies (no retry for mutating requests).502payloads plus429/503.New / existing config knobs (optional overrides)
All keys are optional; defaults are embedded in code for out-of-the-box behavior:
relay_retry_on_502(bool)relay_retry_max_attempts(int)relay_retry_backoff_seconds(float)relay_retry_cooldown_seconds(float)relay_retry_cooldown_max_seconds(float)Trade-offs
Successful paths are unchanged, but temporarily failing hosts may see slightly higher latency due to backoff/cooldown (intentional to reduce error rate).
Testing
Notes for reviewers