Skip to content

Commit

Permalink
Artifact creation: Break retry on any 4xx code
Browse files Browse the repository at this point in the history
There's a debate around which 4xx code we're going to use. #2697 mentions 422 in the title but adds handling for 403. Some people thing 429 is better.

Rather than playing whack-a-mole with all the 4xx codes, I think we should do the same thing as the log uploader and break on any of them.
  • Loading branch information
DrJosh9000 committed Mar 27, 2024
1 parent d0930e1 commit 179c639
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion agent/artifact_batch_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ 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 == 401 || resp.StatusCode == 403 || resp.StatusCode == 404) {
if resp != nil && (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 179c639

Please sign in to comment.