Repository navigation
Eliminate rate limiting by removing spend API and staggering requests - #7
Merged
Merged
Conversation
Removes the spend API call (overage_spend_limit) which was silently getting 429'd and consuming rate limit budget. Decouples plan tier fetch from usage polling so it only fires once at startup with a 2s delay. Adds refreshAll() method for manual refresh (Refresh button) to update both usage and plan staggered by 2s. Reduces normal poll cycles from 2-3 simultaneous requests to 1, preventing 429 rate limit hammering. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Ping completion (StatusBarController) and reset ping (SchedulerService) were calling fetchUsage() directly, bypassing the backoff timer and sending requests while the server was still rate-limiting. Added isBackingOff property to UsageService so these callers skip the fetch when consecutive 429 errors are active. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
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
Fixes persistent HTTP 429 rate limiting by removing the spend API call (
overage_spend_limit) which was silently getting rate-limited while still consuming the server's rate limit budget. Decouples plan tier fetch from usage polling—it now fires once at startup with a 2-second stagger instead of on every poll cycle. AddsrefreshAll()method so the Refresh button updates both usage % and plan tier with staggered timing.Changes
SpendResponsestruct andfetchSpendData()entirelyUsageDataand all spend-related UI/loggingfetchPlanIfNeeded()method (fires once at startup with 2s delay)refreshAll()method for manual refresh via Refresh buttonplanFetchDelaySecondsconstant for stagger timingResult
Each poll cycle now sends exactly one API request (usage only) instead of two-three simultaneous requests, preventing rate limit hammering. The Refresh button updates both metrics with 2-second stagger to avoid simultaneous API calls.
🤖 Generated with Claude Code