Skip to content

feat: stabilize rate limiting behaviour - #1015

Merged
gildesmarais merged 4 commits into
mainfrom
fix/pr-1011-review-feedback
Jun 12, 2026
Merged

feat: stabilize rate limiting behaviour#1015
gildesmarais merged 4 commits into
mainfrom
fix/pr-1011-review-feedback

Conversation

@gildesmarais

Copy link
Copy Markdown
Member

Addresses feedback from PR #1011:

  • Retry-After uses ||= for 503/504
  • Duplicate CODE strings removed from resolve_error_code
  • Rate limiter overflow eviction avoids materializing all keys via streaming iteration
  • Added regression tests for Retry-After preservation

@gildesmarais gildesmarais changed the title Fixes for PR #1011 review feedback feat: stabilize rate limiting behaviour Jun 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-After header for 503/504 responses by switching to ||= assignment.
  • Simplify resolve_error_code by relying on error CODE constants / #code where appropriate.
  • Adjust rate limiter overflow eviction to iterate keys rather than materializing all keys, and add regression specs for Retry-After preservation.

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.

Comment thread app/web/request/rate_limiter.rb
@gildesmarais
gildesmarais enabled auto-merge (squash) June 12, 2026 11:26
@gildesmarais
gildesmarais merged commit 1e6b1f8 into main Jun 12, 2026
15 checks passed
@gildesmarais
gildesmarais deleted the fix/pr-1011-review-feedback branch June 12, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants