mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
refactor(auth): replace NextRefreshAfter with NextRetryAfter for clarity and consistency
- Renamed field `NextRefreshAfter` to `NextRetryAfter` across `AuthManager`, `types`, and selector logic. - Updated references to ensure proper handling of retry timing logic. - Improved code readability and clarified retry behavior for different auth states.
This commit is contained in:
@@ -523,14 +523,14 @@ func (m *Manager) MarkResult(ctx context.Context, result Result) {
|
||||
switch statusCode {
|
||||
case 401:
|
||||
auth.StatusMessage = "unauthorized"
|
||||
auth.NextRefreshAfter = now.Add(30 * time.Minute)
|
||||
auth.NextRetryAfter = now.Add(30 * time.Minute)
|
||||
if result.Model != "" {
|
||||
shouldSuspendModel = true
|
||||
suspendReason = "unauthorized"
|
||||
}
|
||||
case 402, 403:
|
||||
auth.StatusMessage = "payment_required"
|
||||
auth.NextRefreshAfter = now.Add(30 * time.Minute)
|
||||
auth.NextRetryAfter = now.Add(30 * time.Minute)
|
||||
if result.Model != "" {
|
||||
shouldSuspendModel = true
|
||||
suspendReason = "payment_required"
|
||||
@@ -540,14 +540,14 @@ func (m *Manager) MarkResult(ctx context.Context, result Result) {
|
||||
auth.Quota.Exceeded = true
|
||||
auth.Quota.Reason = "quota"
|
||||
auth.Quota.NextRecoverAt = now.Add(30 * time.Minute)
|
||||
auth.NextRefreshAfter = auth.Quota.NextRecoverAt
|
||||
auth.NextRetryAfter = auth.Quota.NextRecoverAt
|
||||
if result.Model != "" {
|
||||
shouldSuspendModel = true
|
||||
registry.GetGlobalRegistry().SetModelQuotaExceeded(auth.ID, result.Model)
|
||||
}
|
||||
case 408, 500, 502, 503, 504:
|
||||
auth.StatusMessage = "transient upstream error"
|
||||
auth.NextRefreshAfter = now.Add(1 * time.Minute)
|
||||
auth.NextRetryAfter = now.Add(1 * time.Minute)
|
||||
if result.Model != "" {
|
||||
shouldSuspendModel = false
|
||||
suspendReason = "forbidden"
|
||||
|
||||
Reference in New Issue
Block a user