feat: add configurable rate limit retry delays [vibe by AI]#195
feat: add configurable rate limit retry delays [vibe by AI]#195tctinh merged 1 commit intoNoeFabris:devfrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis pull request adds configurable parameters for rate-limit retry behavior. The changes introduce three new configuration options to the schema: Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryAdded two new configuration options (
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant Plugin
participant API
participant Config
Client->>Plugin: Make API request
Plugin->>API: Forward request
API-->>Plugin: 429 Rate Limit
Plugin->>Config: Get default_retry_after_seconds
Config-->>Plugin: 60s (or custom value)
Plugin->>Plugin: retryAfterMsFromResponse(response, defaultRetryMs)
Note over Plugin: Check retry-after-ms header<br/>Check retry-after header<br/>Fallback to defaultRetryMs
Plugin->>Config: Get max_backoff_seconds
Config-->>Plugin: 60s (or custom value)
Plugin->>Plugin: getRateLimitBackoff(accountIndex, quotaKey, serverRetryMs, maxBackoffMs)
Note over Plugin: Calculate exponential backoff<br/>Cap delay with maxBackoffMs<br/>Track consecutive 429s
Plugin->>Plugin: Wait delayMs
Plugin->>API: Retry request
|
Greptile found no issues!From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
|
Change merge target to dev, please fix conflict |
Add two new configuration options to allow users to tune rate limit behavior: - default_retry_after_seconds: Default retry delay when API doesn't return a retry-after header (default: 60s, configurable 1-300s) - max_backoff_seconds: Maximum cap for exponential backoff delay (default: 60s, configurable 5-300s) These options help users who want faster retries at the cost of potentially hitting more 429 errors, or users who prefer longer delays to preserve prompt cache by staying on the same account. The hardcoded 60-second values are now configurable while maintaining backward compatibility with existing configurations.
bfc8c0d to
2845cd9
Compare
Summary
Add two new configuration options to allow users to tune rate limit retry behavior without modifying source code.
Motivation
The current hardcoded 60-second default for rate limit retries can feel too long for users who:
retry-afterheaderConversely, some users may want longer delays to preserve prompt cache by staying on the same account longer.
Changes
New Configuration Options
default_retry_after_secondsmax_backoff_secondsExample Configuration
{
"default_retry_after_seconds": 10,
"max_backoff_seconds": 30
}
This configuration reduces the default wait from 60s to 10s, and caps exponential backoff at 30s.
Backward Compatibility