Skip to content

Allow to define custom bucket size - #95

Closed
mosch wants to merge 1 commit into
jhurliman:mainfrom
mosch:main
Closed

mosch wants to merge 1 commit into
jhurliman:mainfrom
mosch:main

Conversation

@mosch

@mosch mosch commented Sep 6, 2023

Copy link
Copy Markdown

Hey @jhurliman , thanks for this clean library!
I wanted to define the bucket size independent from the tokensPerInterval, so I added the option.

Let me know what you think!

@jhurliman

Copy link
Copy Markdown
Owner

Thanks @mosch for the independent bucket-size proposal. I reviewed it during #105. TokenBucket already supports independent bucketSize/tokensPerInterval. RateLimiter also imposes an interval cap, so a larger bucket would not permit a larger per-interval burst. This patch additionally leaves initial content set to tokensPerInterval, which can overfill a smaller configured bucket. Keeping the feature proposal open for an explicit contract: initial fill at capacity, impossible requests bounded by both limits, and deterministic tests for smaller/larger capacities and getWaitTime. The current README now distinguishes the two limiter models.

@mosch mosch closed this Sep 11, 2026
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