Przeglądaj źródła

feat: 超时状态码不重试

CaIon 1 rok temu
rodzic
commit
fed1a1d6a3
1 zmienionych plików z 4 dodań i 0 usunięć
  1. 4 0
      controller/relay.go

+ 4 - 0
controller/relay.go

@@ -93,6 +93,10 @@ func shouldRetry(c *gin.Context, channelId int, openaiErr *dto.OpenAIErrorWithSt
 		return true
 		return true
 	}
 	}
 	if openaiErr.StatusCode/100 == 5 {
 	if openaiErr.StatusCode/100 == 5 {
+		// 超时不重试
+		if openaiErr.StatusCode == 504 || openaiErr.StatusCode == 524 {
+			return false
+		}
 		return true
 		return true
 	}
 	}
 	if openaiErr.StatusCode == http.StatusBadRequest {
 	if openaiErr.StatusCode == http.StatusBadRequest {