From 50a673285945b316407e058e79b4ade6f1a6131a Mon Sep 17 00:00:00 2001 From: Robert Neumayer Date: Wed, 10 Feb 2021 16:46:00 +0100 Subject: [PATCH] Use http constants and use switch instead of if --- builder/oracle/oci/driver_oci.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/builder/oracle/oci/driver_oci.go b/builder/oracle/oci/driver_oci.go index a0ab53aeb..c29828a6f 100644 --- a/builder/oracle/oci/driver_oci.go +++ b/builder/oracle/oci/driver_oci.go @@ -6,6 +6,7 @@ import ( "fmt" "math" "math/rand" + "net/http" "regexp" "sync/atomic" "time" @@ -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 } }