feat(strategy): add quota-awareness to hybrid account selection
The hybrid strategy now considers account quota levels when selecting accounts, preventing any single account from being drained to 0%. - Add QuotaTracker class to track per-account quota levels - Exclude accounts with critical quota (<5%) from selection - Add quota component to scoring formula (weight: 3) - Fall back to critical accounts when no alternatives exist - Add 18 new tests for quota-aware selection Scoring formula: Health×2 + Tokens×5 + Quota×3 + LRU×0.1 An attempt at resolving badrisnarayanan/antigravity-claude-proxy#171
This commit is contained in:
@@ -34,6 +34,12 @@ const DEFAULT_CONFIG = {
|
||||
maxTokens: 50, // Maximum token capacity
|
||||
tokensPerMinute: 6, // Regeneration rate
|
||||
initialTokens: 50 // Starting tokens
|
||||
},
|
||||
quota: {
|
||||
lowThreshold: 0.10, // 10% - reduce score
|
||||
criticalThreshold: 0.05, // 5% - exclude from candidates
|
||||
staleMs: 300000, // 5 min - max age of quota data to trust
|
||||
weight: 3 // Scoring weight (same scale as health/tokens)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user