feat: stabilize rate limiting behaviour - #1015
Merged
Merged
Conversation
gildesmarais
force-pushed
the
fix/pr-1011-review-feedback
branch
from
June 12, 2026 10:58
f36880b to
c20d612
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines and stabilizes rate-limiting and error-response behavior in html2rss-web, focusing on preserving caller-provided Retry-After headers for timeout-related errors, reducing duplicated error-code strings, and improving overflow eviction to avoid materializing all rate-limiter keys.
Changes:
- Preserve an existing
Retry-Afterheader for 503/504 responses by switching to||=assignment. - Simplify
resolve_error_codeby relying on errorCODEconstants /#codewhere appropriate. - Adjust rate limiter overflow eviction to iterate keys rather than materializing all keys, and add regression specs for
Retry-Afterpreservation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| spec/html2rss/web/error_responder_spec.rb | Adds regression coverage ensuring existing Retry-After headers are preserved for 503/504. |
| app/web/request/rate_limiter.rb | Changes overflow eviction strategy to avoid allocating @history.keys during eviction. |
| app/web/errors/error_responder.rb | Preserves pre-set Retry-After for 503/504 and deduplicates error code resolution via constants. |
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.
Addresses feedback from PR #1011:
Retry-Afteruses||=for 503/504CODEstrings removed fromresolve_error_codeRetry-Afterpreservation