fix(auth): handle quota cooldown in retry logic for transient errors
Unified · Split
| @@ -1416,8 +1416,12 @@ func (m *Manager) MarkResult(ctx context.Context, result Result) { · 1415 unmodified lines | ||
| 1416 | 1416 | shouldSuspendModel = true |
| 1417 | 1417 | setModelQuota = true |
| 1418 | 1418 | case 408, 500, 502, 503, 504: |
| 1419 | − next := now.Add(1 * time.Minute) | |
| 1420 | − state.NextRetryAfter = next | |
| 1419 | + if quotaCooldownDisabled.Load() { | |
| 1420 | + state.NextRetryAfter = time.Time{} | |
| 1421 | + } else { | |
| 1422 | + next := now.Add(1 * time.Minute) | |
| 1423 | + state.NextRetryAfter = next | |
| 1424 | + } | |
| 1421 | 1425 | default: |
| 1422 | 1426 | state.NextRetryAfter = time.Time{} |
| 1423 | 1427 | } |
| @@ -1668,7 +1672,11 @@ func applyAuthFailureState(auth *Auth, resultErr *Error, retryAfter *time.Durati · 244 unmodified lines | ||
| 1668 | 1672 | auth.NextRetryAfter = next |
| 1669 | 1673 | case 408, 500, 502, 503, 504: |
| 1670 | 1674 | auth.StatusMessage = "transient upstream error" |
| 1671 | − auth.NextRetryAfter = now.Add(1 * time.Minute) | |
| 1675 | + if quotaCooldownDisabled.Load() { | |
| 1676 | + auth.NextRetryAfter = time.Time{} | |
| 1677 | + } else { | |
| 1678 | + auth.NextRetryAfter = now.Add(1 * time.Minute) | |
| 1679 | + } | |
| 1672 | 1680 | default: |
| 1673 | 1681 | if auth.StatusMessage == "" { |
| 1674 | 1682 | auth.StatusMessage = "request failed" |