fix: avoid double markFailed in AI proxy retry loop
Response handler already calls markFailed() on non-2xx and network errors (which rotates the proxy). The preamble at attempt >= 2 was calling markFailed() again, double-rotating and skipping a proxy. Changed preamble to use rotate() instead of markFailed(). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
2dfb87eac6
commit
5974d31164
+1
-1
@@ -318,7 +318,7 @@ export async function handleChatCompletion(
|
||||
} else if (attempt === 1 && proxyPool && proxyPool.size > 0) {
|
||||
init.proxy = proxyPool.getProxyUrl()!;
|
||||
} else if (attempt >= 2 && proxyPool && proxyPool.size > 0) {
|
||||
const next = proxyPool.markFailed();
|
||||
const next = proxyPool.rotate();
|
||||
if (!next) break;
|
||||
init.proxy = proxyPool.getProxyUrl()!;
|
||||
} else {
|
||||
|
||||
@@ -408,7 +408,7 @@ export async function handleAnthropicMessages(
|
||||
} else if (attempt === 1 && proxyPool && proxyPool.size > 0) {
|
||||
init.proxy = proxyPool.getProxyUrl()!;
|
||||
} else if (attempt >= 2 && proxyPool && proxyPool.size > 0) {
|
||||
const next = proxyPool.markFailed();
|
||||
const next = proxyPool.rotate();
|
||||
if (!next) break;
|
||||
init.proxy = proxyPool.getProxyUrl()!;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user