handle rate limits gracefully, and add ability to check google server for every request in case they reset rate limits on their end, thereby not relying on local cache alone
This commit is contained in:
@@ -204,6 +204,21 @@ export class AccountManager {
|
||||
return cleared;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all rate limits to force a fresh check
|
||||
* (Optimistic retry strategy)
|
||||
*/
|
||||
resetAllRateLimits() {
|
||||
for (const account of this.#accounts) {
|
||||
account.isRateLimited = false;
|
||||
// distinct from "clearing" expired limits, we blindly reset here
|
||||
// we keep the time? User said "clear isRateLimited value, and rateLimitResetTime"
|
||||
// So we clear both.
|
||||
account.rateLimitResetTime = null;
|
||||
}
|
||||
console.log('[AccountManager] Reset all rate limits for optimistic retry');
|
||||
}
|
||||
|
||||
/**
|
||||
* Pick the next available account (round-robin)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user