Skip to content

Commit

Permalink
Don't break on 429
Browse files Browse the repository at this point in the history
429 can be a symptom of overload, rather than a problem with the request itself.
  • Loading branch information
DrJosh9000 committed Mar 27, 2024
1 parent 179c639 commit a6ff2e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion agent/artifact_batch_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ func (a *ArtifactBatchCreator) Create(ctx context.Context) ([]*api.Artifact, err

creation, resp, err := a.apiClient.CreateArtifacts(ctxTimeout, a.conf.JobID, batch)
// the server returns a 403 code if the artifact has exceeded the service quota
if resp != nil && (resp.StatusCode >= 400 && resp.StatusCode <= 499) {
// Break the retry on any 4xx code except for 429 Too Many Requests.
if resp != nil && (resp.StatusCode != 429 && resp.StatusCode >= 400 && resp.StatusCode <= 499) {
a.logger.Warn("Artifact creation failed with status code %d, breaking the retry loop", resp.StatusCode)
r.Break()
}
Expand Down

0 comments on commit a6ff2e5

Please sign in to comment.