mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
feat: add client availability tracking and error handling improvements
- Introduced `IsAvailable` and `SetUnavailable` methods to clients for availability tracking. - Integrated availability checks in client selection logic to skip unavailable clients. - Enhanced error handling by marking clients unavailable on specific error codes (e.g., 401, 402). - Removed redundant quota verification logs in client reordering logic.
This commit is contained in:
@@ -205,9 +205,13 @@ outLoop:
|
||||
err := cliClient.RefreshTokens(cliCtx)
|
||||
if err != nil {
|
||||
log.Debugf("refresh token failed, switch client, %s", util.HideAPIKey(cliClient.GetEmail()))
|
||||
cliClient.SetUnavailable()
|
||||
}
|
||||
retryCount++
|
||||
continue outLoop
|
||||
case 402:
|
||||
cliClient.SetUnavailable()
|
||||
continue outLoop
|
||||
default:
|
||||
// Forward other errors directly to the client
|
||||
c.Status(errInfo.StatusCode)
|
||||
|
||||
Reference in New Issue
Block a user