Commit 8917afab authored by erio's avatar erio
Browse files

fix(antigravity): reduce 429 fallback cooldown from 5min to 30s

The default fallback cooldown when rate limit reset time cannot be
parsed was 5 minutes, which is too aggressive and causes accounts
to be unnecessarily locked out. Reduce to 30 seconds for faster
recovery. Config override still works (unit remains minutes).
parent 39a5b17d
...@@ -2048,11 +2048,12 @@ func (s *AntigravityGatewayService) handleUpstreamError(ctx context.Context, pre ...@@ -2048,11 +2048,12 @@ func (s *AntigravityGatewayService) handleUpstreamError(ctx context.Context, pre
resetAt := ParseGeminiRateLimitResetTime(body) resetAt := ParseGeminiRateLimitResetTime(body)
if resetAt == nil { if resetAt == nil {
// 解析失败:使用配置的 fallback 时间,直接限流整个账户 // 解析失败:使用配置的 fallback 时间,直接限流整个账户
fallbackMinutes := 5 // 默认 30 秒,可通过配置覆盖(配置单位为分钟)
fallbackSeconds := 30
if s.settingService != nil && s.settingService.cfg != nil && s.settingService.cfg.Gateway.AntigravityFallbackCooldownMinutes > 0 { if s.settingService != nil && s.settingService.cfg != nil && s.settingService.cfg.Gateway.AntigravityFallbackCooldownMinutes > 0 {
fallbackMinutes = s.settingService.cfg.Gateway.AntigravityFallbackCooldownMinutes fallbackSeconds = s.settingService.cfg.Gateway.AntigravityFallbackCooldownMinutes * 60
} }
defaultDur := time.Duration(fallbackMinutes) * time.Minute defaultDur := time.Duration(fallbackSeconds) * time.Second
if fallbackDur, ok := antigravityFallbackCooldownSeconds(); ok { if fallbackDur, ok := antigravityFallbackCooldownSeconds(); ok {
defaultDur = fallbackDur defaultDur = fallbackDur
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment