Dual-path retry: exponential backoff + rate-limit handling#280
Open
MichaelGHSeg wants to merge 3 commits into
Open
Dual-path retry: exponential backoff + rate-limit handling#280MichaelGHSeg wants to merge 3 commits into
MichaelGHSeg wants to merge 3 commits into
Conversation
- Transport: dual-path retry loop (429+Retry-After vs counted exponential backoff), X-Retry-Count header on retries, retryable status classification (5xx except 501/505/511; 4xx only 408/410/429/460) - BackoffPolicy: update constants (base 500ms, cap 60s, multiplier 2); add reset! method - Response: add success? method (2xx+3xx) - Defaults: add MAX_TOTAL_BACKOFF_DURATION, MAX_RATE_LIMIT_DURATION, RATE_LIMIT_RETRY_AFTER_CAP constants - Worker: use response.success? instead of status == 200 - Tests: cover new retry paths, X-Retry-Count, parse_retry_after, retryable/non-retryable status codes
…pdate - Add reset! to FakeBackoffPolicy so transport specs don't crash - Narrow success? and success_status? to 2xx only (Net::HTTP doesn't follow redirects, so 3xx would silently lose batches) - Update malformed-JSON-on-200 test to match new semantics: a 200 means the server accepted the batch regardless of body parseability
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
Replaces the original retry loop with a structured dual-path retry system.
rate_limit_retry_after_cap), does NOT consume the retry budget. Bounded bymax_rate_limit_duration(default 12h).retriescount andmax_total_backoff_duration(default 12h).X-Retry-Countheader on retry attempts.success?/success_status?to 2xx only —Net::HTTPdoesn't follow redirects, so treating 3xx as success would silently drop batches.FakeBackoffPolicymissingreset!method (caused all transport specs using custom backoff policies to crash).retrytest suite.Test plan
bundle exec rake specpassesbasic,retrysuites pass (48/48)