Max available capacity limiter#1
Open
xmartis3 wants to merge 21 commits intomain-ceritfrom
Open
Conversation
- tokens_to_add→ requests_to_add - current_tokens → current_requests
- Remove TypedDict types for cache data - Store cache values separately instead of nested objects - Simplify budget management logic
- Add DEFAULT_TTL_TIME constant (300 seconds) - Use async_increment_cache with TTL for all cache operations - Fix refill logic to properly track last_refill timestamp - Remove unused self._prev_load attribute - Extract BASE_RATE as module-level constant - Fix _fetch_tokens_used_in_window to use last_refill instead of timestamp - Return int from _refill_user_budget after increment
- Added missing await to _get_model_limits() call which was causing 'cannot unpack non-iterable coroutine object' error - Fixed cache key usage to use constants instead of inline strings - Added requests_used tracking alongside tokens_used for workload calculation - Removed unused DEFAULT_REFILL_RATE and WORKLOAD_WINDOW_MINUTES variables The error occurred because _get_model_limits is an async function but was being called without await on line 189, returning a coroutine instead of the expected tuple of (tpm_limit, rpm_limit).
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.
No description provided.