File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
staging/src/k8s.io/legacy-cloud-providers/azure/retry Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -125,8 +125,9 @@ func getHTTPStatusCode(resp *http.Response) int {
125
125
// shouldRetryHTTPRequest determines if the request is retriable.
126
126
func shouldRetryHTTPRequest (resp * http.Response , err error ) bool {
127
127
if resp != nil {
128
- // HTTP 412 (StatusPreconditionFailed) means etag mismatch, hence we shouldn't retry.
129
- if resp .StatusCode == http .StatusPreconditionFailed {
128
+ // HTTP 412 (StatusPreconditionFailed) means etag mismatch
129
+ // HTTP 400 (BadRequest) means the request cannot be accepted, hence we shouldn't retry.
130
+ if resp .StatusCode == http .StatusPreconditionFailed || resp .StatusCode == http .StatusBadRequest {
130
131
return false
131
132
}
132
133
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ func TestGetError(t *testing.T) {
54
54
{
55
55
code : http .StatusBadRequest ,
56
56
expected : & Error {
57
- Retriable : true ,
57
+ Retriable : false ,
58
58
HTTPStatusCode : http .StatusBadRequest ,
59
59
RawError : fmt .Errorf ("HTTP response: 400" ),
60
60
},
@@ -136,7 +136,7 @@ func TestGetStatusNotFoundAndForbiddenIgnoredError(t *testing.T) {
136
136
{
137
137
code : http .StatusBadRequest ,
138
138
expected : & Error {
139
- Retriable : true ,
139
+ Retriable : false ,
140
140
HTTPStatusCode : http .StatusBadRequest ,
141
141
RawError : fmt .Errorf ("HTTP response: 400" ),
142
142
},
@@ -191,7 +191,7 @@ func TestShouldRetryHTTPRequest(t *testing.T) {
191
191
}{
192
192
{
193
193
code : http .StatusBadRequest ,
194
- expected : true ,
194
+ expected : false ,
195
195
},
196
196
{
197
197
code : http .StatusInternalServerError ,
You can’t perform that action at this time.
0 commit comments