Skip to content

fix: apply configured leaky bucket throughput - #167

Merged
ehsandeep merged 4 commits into
mainfrom
codex/leaky-bucket-throughput
Sep 14, 2026
Merged

ehsandeep merged 4 commits into
mainfrom
codex/leaky-bucket-throughput

Conversation

@knakul853

Copy link
Copy Markdown
Contributor

Summary

  • refill leaky buckets at max / duration instead of one token per duration
  • keep the underlying rate synchronized when limit or duration changes
  • unblock waiting callers when the limiter context is cancelled

Reproduction

  • NewLeakyBucket(ctx, 50, time.Second) previously exposed an underlying rate of 1 token/second; it now exposes 50 tokens/second
  • a blocked Take previously remained blocked after context cancellation; it now returns

Testing

  • go test -race -run "TestRateLimit/LeakyBucket" -count=1 -v
  • go test ./... -count=1

Open in Codex: codex://threads/01a07d91-20ab-7a33-81ae-cfd2520595f4
Resume from CLI: codex resume 01a07d91-20ab-7a33-81ae-cfd2520595f4

@knakul853
knakul853 marked this pull request as ready for review September 13, 2026 17:38
@knakul853 knakul853 self-assigned this Sep 13, 2026
@ehsandeep
ehsandeep merged commit 817c228 into main Sep 14, 2026
7 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.

3 participants