From 2ab9ded58f81b0453e635bd110d7075e21760b5d Mon Sep 17 00:00:00 2001 From: enoch Date: Sun, 10 Aug 2025 13:06:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(proxy):=20=E6=8E=92=E9=99=A4404=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=A0=81=E9=81=BF=E5=85=8D=E6=97=A0=E6=84=8F=E4=B9=89?= =?UTF-8?q?=E9=87=8D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当请求资源不存在时,不代表key无效,反而可能错误地将key判断为无效,而且此时重试没有意义 --- internal/proxy/server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/proxy/server.go b/internal/proxy/server.go index 62a2e46..8dc8485 100644 --- a/internal/proxy/server.go +++ b/internal/proxy/server.go @@ -181,7 +181,8 @@ func (ps *ProxyServer) executeRequestWithRetry( } // 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) { 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)