fix where models didnt wait if retrydelay is less than 2 mins for multi account scenario
This commit is contained in:
@@ -256,19 +256,12 @@ export async function sendMessage(anthropicRequest, accountManager) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accountManager.getAccountCount() === 1) {
|
// Wait for reset (applies to both single and multi-account modes)
|
||||||
// Single account mode: wait for reset
|
const accountCount = accountManager.getAccountCount();
|
||||||
console.log(`[CloudCode] Single account rate-limited. Waiting ${formatDuration(waitMs)}...`);
|
console.log(`[CloudCode] All ${accountCount} account(s) rate-limited. Waiting ${formatDuration(waitMs)}...`);
|
||||||
await sleep(waitMs);
|
await sleep(waitMs);
|
||||||
accountManager.clearExpiredLimits();
|
accountManager.clearExpiredLimits();
|
||||||
account = accountManager.pickNext();
|
account = accountManager.pickNext();
|
||||||
} else {
|
|
||||||
// Multi-account: all exhausted - throw proper error
|
|
||||||
throw new Error(
|
|
||||||
`RESOURCE_EXHAUSTED: All ${accountManager.getAccountCount()} accounts rate-limited. ` +
|
|
||||||
`quota will reset after ${formatDuration(waitMs)}. Next available: ${resetTime}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!account) {
|
if (!account) {
|
||||||
@@ -509,19 +502,12 @@ export async function* sendMessageStream(anthropicRequest, accountManager) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accountManager.getAccountCount() === 1) {
|
// Wait for reset (applies to both single and multi-account modes)
|
||||||
// Single account mode: wait for reset
|
const accountCount = accountManager.getAccountCount();
|
||||||
console.log(`[CloudCode] Single account rate-limited. Waiting ${formatDuration(waitMs)}...`);
|
console.log(`[CloudCode] All ${accountCount} account(s) rate-limited. Waiting ${formatDuration(waitMs)}...`);
|
||||||
await sleep(waitMs);
|
await sleep(waitMs);
|
||||||
accountManager.clearExpiredLimits();
|
accountManager.clearExpiredLimits();
|
||||||
account = accountManager.pickNext();
|
account = accountManager.pickNext();
|
||||||
} else {
|
|
||||||
// Multi-account: all exhausted - throw proper error
|
|
||||||
throw new Error(
|
|
||||||
`RESOURCE_EXHAUSTED: All ${accountManager.getAccountCount()} accounts rate-limited. ` +
|
|
||||||
`quota will reset after ${formatDuration(waitMs)}. Next available: ${resetTime}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!account) {
|
if (!account) {
|
||||||
|
|||||||
Reference in New Issue
Block a user