Fix client.connection_rate_limit refilling at 1 req/sec - #1207
Merged
FZambia merged 1 commit intoAug 18, 2026
Conversation
- Use the configured connection limit as the token bucket's sustained per-second rate. - Preserve the configured burst size. - Assert the sustained rate and burst in the existing middleware regression test.
moses-mbaga
marked this pull request as ready for review
August 18, 2026 16:13
Member
|
Hi @moses-mbaga Many thanks for the report and the fix! |
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.
Proposed changes
client.connection_rate_limitas the token bucket's sustained per-second rate.The limiter currently uses
rate.Every(time.Second), which always refills at one request per second regardless of the configured limit. Converting the configured integer torate.Limitmakes the sustained rate match the documented behavior.Validation
go test -race ./internal/middleware -count=1go build ./...golangci-lint run --timeout 10m0swith the repository-pinned v2.11.1Fixes #1206