Skip to content

Commit

Permalink
Use http constants and use switch instead of if
Browse files Browse the repository at this point in the history
  • Loading branch information
neumayer committed Feb 10, 2021
1 parent bcd60c3 commit 50a6732
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion builder/oracle/oci/driver_oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"math"
"math/rand"
"net/http"
"regexp"
"sync/atomic"
"time"
Expand All @@ -28,7 +29,8 @@ var retryPolicy = &common.RetryPolicy{
ShouldRetryOperation: func(res common.OCIOperationResponse) bool {
var e common.ServiceError
if errors.As(res.Error, &e) {
if e.GetHTTPStatusCode() == 429 || e.GetHTTPStatusCode() == 500 || e.GetHTTPStatusCode() == 503 {
switch e.GetHTTPStatusCode() {
case http.StatusTooManyRequests, http.StatusInternalServerError, http.StatusServiceUnavailable:
return true
}
}
Expand Down

0 comments on commit 50a6732

Please sign in to comment.