Dual-path retry: exponential backoff + rate-limit handling#251
Open
MichaelGHSeg wants to merge 2 commits into
Open
Dual-path retry: exponential backoff + rate-limit handling#251MichaelGHSeg wants to merge 2 commits into
MichaelGHSeg wants to merge 2 commits into
Conversation
- LibCurl: dual-path retry loop (429+Retry-After vs counted exponential backoff), X-Retry-Count header on retries, retryable status classification, duration budgets - QueueConsumer: add retry config properties (max_total_backoff_duration_ms, max_rate_limit_duration_ms, rate_limit_retry_after_cap_s, retry_count); fix queue splice bug (peek with array_slice, splice only on success); add isRetryable() and parseRetryAfter() helpers - Socket: update DoPost signature for X-Retry-Count; use success range check (>= 200 && < 400)
- Make error_handler log-only; determine success from enqueue/flush return values to avoid false failures from transient retry errors - Wire maxRetries from input config to retry_count option - Remove duplicate "Flush failed" in error output - Enable retry test suite in e2e-config
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
Rewrites
LibCurl::flushBatch()with a structured dual-path retry system.rate_limit_retry_after_cap_s, default 300s), does NOT consume the retry budget. Bounded bymax_rate_limit_duration_ms(default 12h).retry_countandmax_total_backoff_duration_ms(default 12h).X-Retry-Countheader on retry attempts.array_spliceordering inQueueConsumer::flush()— batch is removed from the queue before callingflushBatch(), which handles all retries internally. This prevents__destruct()from re-flushing batches that already exhausted their retry budget.enqueue()/flush()return values only (not theerror_handlercallback, which fires for transient per-attempt errors too). WiresmaxRetriesfrom input config.retrytest suite.Test plan
./vendor/bin/phpunit --no-coveragepassesbasic,retrysuites pass (48/48)