SIGN IN SIGN UP

fix(proxy): stop usage-poll timers on account removal and server shutdown

Account removal called usageCache.delete(), which only clears the
cache entry, not the poll timer or tracking maps. Since scheduleNextPoll
reschedules itself as long as tokenProviders still has the accountId,
this left the poll loop running indefinitely against deleted accounts.
Switch to usageCache.stopPolling(), which clears the timer and all
associated per-account state.

Also add unregisterPollingRestarter/unregisterRefreshClearer, mirroring
the existing unregisterCodexUsageRefresher pattern, and call them from
handleGracefulShutdown so the module-level registries in token-manager.ts
don't accumulate stale per-server callbacks on restart.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
T
tombii committed
d66e3f8b2d76360db18fcedd8615fce8f4038828
Parent: ebc9049