chore(server): revert stale-cache compensation for hallucinated endpoint (#23)

Removes the stale-cache fallback branches in handleUsage() and
handleStatus() originally introduced by cb6c2a8 (2026-04-12).

Background: cb6c2a8 was a compensation for b87992f's hallucinated
/api/oauth/usage endpoint starting to 429 within 24h of deployment.
Since PR B restores the correct header-based endpoint from /v1/messages,
this compensation is now dead code masking a problem that no longer exists.

Changes:
  - handleUsage: remove `else if (usageCache.data)` stale fallback
  - handleStatus: remove `else if (usageCache.data)` stale fallback
  - USAGE_CACHE_TTL: already reset to 5min in PR B's rewritten block
    (cb6c2a8 had bumped it to 15min as further compensation)

Depends on #21 (PR B: restore header-based /usage). Merge PR B first.

Co-authored-by: Oracle Public Cloud User <opc@instance-20230820-1333.subnet07301351.vcn07301351.oraclevcn.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
dtzp555-max
2026-04-20 13:17:11 +10:00
committed by GitHub
co-authored by Oracle Public Cloud User Claude Opus 4.6
parent 2853088261
commit 6bfffd2cba
-5
View File
@@ -930,9 +930,6 @@ async function handleUsage(_req, res) {
data = await fetchUsageFromApi(); data = await fetchUsageFromApi();
if (!data.error) { if (!data.error) {
usageCache = { data, fetchedAt: now }; usageCache = { data, fetchedAt: now };
} else if (usageCache.data) {
// Fallback to stale cache on error (e.g. 429 rate limit)
data = { ...usageCache.data, _stale: true, _fetchError: data.error };
} }
} }
// Always attach live model stats and proxy stats (not cached) // Always attach live model stats and proxy stats (not cached)
@@ -1004,8 +1001,6 @@ async function handleStatus(_req, res) {
usage = await fetchUsageFromApi(); usage = await fetchUsageFromApi();
if (!usage.error) { if (!usage.error) {
usageCache = { data: usage, fetchedAt: now }; usageCache = { data: usage, fetchedAt: now };
} else if (usageCache.data) {
usage = { ...usageCache.data, _stale: true };
} }
} }