mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 20:00:47 +00:00
feat: add sticky round-robin routing strategy
Implements a "sticky" round-robin strategy that uses the same provider account for a configurable number of consecutive calls (default 3) before switching to the next one. This optimizes for prompt caching by reducing organization/account rotation. Adds a configuration input to the Profile settings page. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
decolua
co-authored by
Claude Sonnet 4.5
parent
f2abcc6585
commit
4f292aae63
+6
-3
@@ -39,7 +39,8 @@ const defaultData = {
|
||||
combos: [],
|
||||
apiKeys: [],
|
||||
settings: {
|
||||
cloudEnabled: false
|
||||
cloudEnabled: false,
|
||||
stickyRoundRobinLimit: 3
|
||||
}
|
||||
};
|
||||
|
||||
@@ -178,7 +179,8 @@ export async function createProviderConnection(data) {
|
||||
"displayName", "email", "globalPriority", "defaultModel",
|
||||
"accessToken", "refreshToken", "expiresAt", "tokenType",
|
||||
"scope", "idToken", "projectId", "apiKey", "testStatus",
|
||||
"lastTested", "lastError", "lastErrorAt", "rateLimitedUntil", "expiresIn", "errorCode"
|
||||
"lastTested", "lastError", "lastErrorAt", "rateLimitedUntil", "expiresIn", "errorCode",
|
||||
"consecutiveUseCount"
|
||||
];
|
||||
|
||||
for (const field of optionalFields) {
|
||||
@@ -470,7 +472,8 @@ export async function cleanupProviderConnections() {
|
||||
"displayName", "email", "globalPriority", "defaultModel",
|
||||
"accessToken", "refreshToken", "expiresAt", "tokenType",
|
||||
"scope", "idToken", "projectId", "apiKey", "testStatus",
|
||||
"lastTested", "lastError", "lastErrorAt", "rateLimitedUntil", "expiresIn"
|
||||
"lastTested", "lastError", "lastErrorAt", "rateLimitedUntil", "expiresIn",
|
||||
"consecutiveUseCount"
|
||||
];
|
||||
|
||||
let cleaned = 0;
|
||||
|
||||
Reference in New Issue
Block a user