Skip to content

Commit

Permalink
Add retry on 502 return code
Browse files Browse the repository at this point in the history
In this PR we add the 502 (Bad Gateway) to the list of http return codes
that will result in a retry.  This is to alleviate errors seen in some
runtime environments.

Signed-off-by: Eamonn O'Toole <[email protected]>
  • Loading branch information
eamonnotoole committed Oct 9, 2024
1 parent b8c4e76 commit b4d6250
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/token/token-util/token-util.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) Copyright 2021-2023 Hewlett Packard Enterprise Development LP
// (C) Copyright 2021-2024 Hewlett Packard Enterprise Development LP

package tokenutil

Expand Down Expand Up @@ -134,7 +134,8 @@ func ManageHTTPErrorCodes(resp *http.Response, clientID string) error {
}

func isStatusRetryable(statusCode int) bool {
if statusCode == http.StatusInternalServerError || statusCode == http.StatusTooManyRequests {
if statusCode == http.StatusInternalServerError || statusCode == http.StatusTooManyRequests ||
statusCode == http.StatusBadGateway {
return true
}

Expand Down

0 comments on commit b4d6250

Please sign in to comment.