icebear0828 Claude Opus 4.6 commited on
Commit
9d65acf
·
1 Parent(s): b3dfc6c

fix: stop resetting local usage counters on rate limit window rollover

Browse files

syncRateLimitWindow() was zeroing request_count, tokens, and
empty_response_count whenever the backend rate limit window changed.
This caused the dashboard to show 0 requests/tokens while the backend
quota still reported usage (e.g. 50% used), because the two data
sources are independent. Local counters now accumulate since account
creation; users can still manually reset via the API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. src/auth/account-pool.ts +1 -8
src/auth/account-pool.ts CHANGED
@@ -286,14 +286,7 @@ export class AccountPool {
286
 
287
  const oldResetAt = entry.usage.window_reset_at;
288
  if (oldResetAt != null && oldResetAt !== newResetAt) {
289
- // Window rolled over reset local counters
290
- console.log(`[AccountPool] Rate limit window rolled for ${entryId} (${entry.email ?? "?"}), resetting usage counters`);
291
- entry.usage.request_count = 0;
292
- entry.usage.input_tokens = 0;
293
- entry.usage.output_tokens = 0;
294
- entry.usage.empty_response_count = 0;
295
- entry.usage.last_used = null;
296
- entry.usage.rate_limit_until = null;
297
  }
298
  entry.usage.window_reset_at = newResetAt;
299
  this.schedulePersist();
 
286
 
287
  const oldResetAt = entry.usage.window_reset_at;
288
  if (oldResetAt != null && oldResetAt !== newResetAt) {
289
+ console.log(`[AccountPool] Rate limit window rolled for ${entryId} (${entry.email ?? "?"}), updating window timestamp`);
 
 
 
 
 
 
 
290
  }
291
  entry.usage.window_reset_at = newResetAt;
292
  this.schedulePersist();