fix(proxy): 排除404状态码避免无意义重试
当请求资源不存在时,不代表key无效,反而可能错误地将key判断为无效,而且此时重试没有意义
This commit is contained in:
@@ -181,7 +181,8 @@ func (ps *ProxyServer) executeRequestWithRetry(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unified error handling for retries.
|
// Unified error handling for retries.
|
||||||
if err != nil || (resp != nil && resp.StatusCode >= 400) {
|
// Exclude 404 from being a retryable error.
|
||||||
|
if err != nil || (resp != nil && resp.StatusCode >= 400 && resp.StatusCode != http.StatusNotFound) {
|
||||||
if err != nil && app_errors.IsIgnorableError(err) {
|
if err != nil && app_errors.IsIgnorableError(err) {
|
||||||
logrus.Debugf("Client-side ignorable error for key %s, aborting retries: %v", utils.MaskAPIKey(apiKey.KeyValue), err)
|
logrus.Debugf("Client-side ignorable error for key %s, aborting retries: %v", utils.MaskAPIKey(apiKey.KeyValue), err)
|
||||||
ps.logRequest(c, group, apiKey, startTime, 499, retryCount+1, err, isStream, upstreamURL, channelHandler, bodyBytes)
|
ps.logRequest(c, group, apiKey, startTime, 499, retryCount+1, err, isStream, upstreamURL, channelHandler, bodyBytes)
|
||||||
|
Reference in New Issue
Block a user