Skip to content

Commit

Permalink
remove manual sleep, as its only needed in extreme concurrency cases
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuZad committed May 11, 2024
1 parent b24ea70 commit 7dc2b5f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions internal/provider/retry_predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"net/http"
"net/url"
"strings"
"time"

"google.golang.org/api/googleapi"
)
Expand Down Expand Up @@ -115,14 +114,12 @@ func isRateLimitExceeded(err error) (bool, string) {
}

if gerr.Code == 429 {
log.Printf("[DEBUG] Dismissed an error as retryable based on error code: %s, delaying retry by 10 seconds", err)
time.Sleep(10 * time.Second)
log.Printf("[DEBUG] Dismissed an error as retryable based on error code: %s", err)
return true, fmt.Sprintf("Retryable error code %d", gerr.Code)
}

if gerr.Code == 403 && (strings.Contains(gerr.Error(), "Quota exceeded") || strings.Contains(gerr.Error(), "quotaExceeded")) {
log.Printf("[DEBUG] Dismissed an error as retryable based on error code: %s, , delaying retry by 10 seconds", err)
time.Sleep(10 * time.Second)
log.Printf("[DEBUG] Dismissed an error as retryable based on error code: %s", err)
return true, fmt.Sprintf("Retryable error code %d", gerr.Code)
}

Expand Down

0 comments on commit 7dc2b5f

Please sign in to comment.