fix(codex): 避免重置机会缺失触发配额刷新

This commit is contained in:
ZheFox
2026-07-16 19:13:09 +08:00
parent f009fb73c3
commit 0099167a6d
3 changed files with 2 additions and 35 deletions
@@ -1020,7 +1020,6 @@ import {
getCodexResetCreditAvailableCount as getCodexResetCreditAvailableCountFromSnapshot,
getVisibleCodexResetCreditItems as getVisibleCodexResetCreditItemsFromSnapshot,
mergeCodexQuotaDisplays,
shouldRefreshMissingCodexResetCredits,
} from './codex-reset-credit-display'
// 扩展端点类型,包含密钥列表
@@ -2444,12 +2443,8 @@ function shouldAutoRefreshCodexQuota(): boolean {
if (isTokenExpiringSoon(key, now)) return true
// 旧缓存缺少 reset-credit 数据时补拉;近期已检查过则等待缓存过期
if (!hasCodexQuotaDisplayData(key) || shouldRefreshMissingCodexResetCredits(
getCodexResetCreditsDisplay(key),
now,
AUTO_QUOTA_REFRESH_STALE_SECONDS,
)) {
// reset-credit 独立于 Token 刷新;这里只按账号配额缓存决定是否后台更新
if (!hasCodexQuotaDisplayData(key)) {
return true
}
// 配额数据超过 5 分钟未更新,也触发刷新