Skip to content

refactor(middleware): clamp remaining tokens with max - #3076

Merged
aldas merged 1 commit into
labstack:masterfrom
elonfliter:refactor/clamp-rate-limit-remaining
Sep 1, 2026
Merged

refactor(middleware): clamp remaining tokens with max#3076
aldas merged 1 commit into
labstack:masterfrom
elonfliter:refactor/clamp-rate-limit-remaining

Conversation

@elonfliter

Copy link
Copy Markdown
Contributor

RateLimiterMemoryStore clamps the floored token count before writing X-RateLimit-Remaining.

Use the built-in max function for the lower bound, preserving the existing zero-floor behavior with less branching.

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.73%. Comparing base (dcb05f0) to head (1d718b6).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3076      +/-   ##
==========================================
+ Coverage   93.34%   95.73%   +2.38%     
==========================================
  Files          43       44       +1     
  Lines        4735     4033     -702     
==========================================
- Hits         4420     3861     -559     
+ Misses        192      172      -20     
+ Partials      123        0     -123     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aldas aldas 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.

LGTM

@aldas
aldas merged commit 07b3c4a into labstack:master Sep 1, 2026
13 checks passed
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