Use token-bucket timed rate limiting#357
Merged
Merged
Conversation
Greptile SummaryThis PR replaces per-worker delay throttling with shared token-bucket rate limiting. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Builder overload] --> B[Timed processor]
B --> C{Window is zero?}
C -->|Yes| D[Worker pool without throttling]
C -->|No| E[Shared token bucket]
E --> F[Acquire start permit]
D --> G[Run with concurrency limit]
F --> G
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart LR
A[Builder overload] --> B[Timed processor]
B --> C{Window is zero?}
C -->|Yes| D[Worker pool without throttling]
C -->|No| E[Shared token bucket]
E --> F[Acquire start permit]
D --> G[Run with concurrency limit]
F --> G
Reviews (3): Last reviewed commit: "feat: add token-bucket rate limiting" | Re-trigger Greptile |
thomhurst
force-pushed
the
agent/timed-token-bucket
branch
from
July 21, 2026 19:50
bc5a93f to
82f4982
Compare
Timed processors limit operation starts per window. New overload separates permit count from maximum in-flight concurrency. Closes #335
thomhurst
force-pushed
the
agent/timed-token-bucket
branch
from
July 21, 2026 19:57
82f4982 to
d9edb29
Compare
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.
Summary
TokenBucketRateLimiterImpact
Long-running operations no longer delay future rate permits when callers configure a larger concurrency cap. Timed processors now model start rate independently from work duration, while existing call sites remain source-compatible.
Validation
dotnet test: 1,617 tests passed across net8.0, net9.0, and net10.0Closes #335