fix(antigravity): route signature retry through url fallback
This commit is contained in:
@@ -844,11 +844,20 @@ func (s *AntigravityGatewayService) Forward(ctx context.Context, c *gin.Context,
|
|||||||
if txErr != nil {
|
if txErr != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
retryReq, buildErr := antigravity.NewAPIRequest(ctx, action, accessToken, retryGeminiBody)
|
retryResult, retryErr := antigravityRetryLoop(antigravityRetryLoopParams{
|
||||||
if buildErr != nil {
|
ctx: ctx,
|
||||||
continue
|
prefix: prefix,
|
||||||
}
|
account: account,
|
||||||
retryResp, retryErr := s.httpUpstream.Do(retryReq, proxyURL, account.ID, account.Concurrency)
|
proxyURL: proxyURL,
|
||||||
|
accessToken: accessToken,
|
||||||
|
action: action,
|
||||||
|
body: retryGeminiBody,
|
||||||
|
quotaScope: quotaScope,
|
||||||
|
c: c,
|
||||||
|
httpUpstream: s.httpUpstream,
|
||||||
|
settingService: s.settingService,
|
||||||
|
handleError: s.handleUpstreamError,
|
||||||
|
})
|
||||||
if retryErr != nil {
|
if retryErr != nil {
|
||||||
appendOpsUpstreamError(c, OpsUpstreamErrorEvent{
|
appendOpsUpstreamError(c, OpsUpstreamErrorEvent{
|
||||||
Platform: account.Platform,
|
Platform: account.Platform,
|
||||||
@@ -862,6 +871,7 @@ func (s *AntigravityGatewayService) Forward(ctx context.Context, c *gin.Context,
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retryResp := retryResult.resp
|
||||||
if retryResp.StatusCode < 400 {
|
if retryResp.StatusCode < 400 {
|
||||||
_ = resp.Body.Close()
|
_ = resp.Body.Close()
|
||||||
resp = retryResp
|
resp = retryResp
|
||||||
@@ -873,8 +883,8 @@ func (s *AntigravityGatewayService) Forward(ctx context.Context, c *gin.Context,
|
|||||||
_ = retryResp.Body.Close()
|
_ = retryResp.Body.Close()
|
||||||
if retryResp.StatusCode == http.StatusTooManyRequests {
|
if retryResp.StatusCode == http.StatusTooManyRequests {
|
||||||
retryBaseURL := ""
|
retryBaseURL := ""
|
||||||
if retryReq.URL != nil {
|
if retryResp.Request != nil && retryResp.Request.URL != nil {
|
||||||
retryBaseURL = retryReq.URL.Scheme + "://" + retryReq.URL.Host
|
retryBaseURL = retryResp.Request.URL.Scheme + "://" + retryResp.Request.URL.Host
|
||||||
}
|
}
|
||||||
log.Printf("%s status=429 rate_limited base_url=%s retry_stage=%s body=%s", prefix, retryBaseURL, stage.name, truncateForLog(retryBody, 200))
|
log.Printf("%s status=429 rate_limited base_url=%s retry_stage=%s body=%s", prefix, retryBaseURL, stage.name, truncateForLog(retryBody, 200))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user