Skip to content

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

Open
elonfliter wants to merge 1 commit into
labstack:masterfrom
elonfliter:refactor/clamp-rate-limit-remaining
Open

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

Conversation

@elonfliter

Copy link
Copy Markdown

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.

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.

1 participant