mirror of
https://github.com/dtzp555-max/ocp.git
synced 2026-07-21 21:15:09 +00:00
chore(server): revert stale-cache compensation for hallucinated endpoint (#23)
Removes the stale-cache fallback branches in handleUsage() and handleStatus() originally introduced bycb6c2a8(2026-04-12). Background:cb6c2a8was 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 (cb6c2a8had 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:
co-authored by
Oracle Public Cloud User
Claude Opus 4.6
parent
2853088261
commit
6bfffd2cba
@@ -930,9 +930,6 @@ async function handleUsage(_req, res) {
|
||||
data = await fetchUsageFromApi();
|
||||
if (!data.error) {
|
||||
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)
|
||||
@@ -1004,8 +1001,6 @@ async function handleStatus(_req, res) {
|
||||
usage = await fetchUsageFromApi();
|
||||
if (!usage.error) {
|
||||
usageCache = { data: usage, fetchedAt: now };
|
||||
} else if (usageCache.data) {
|
||||
usage = { ...usageCache.data, _stale: true };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user