Skip to content

Commit

Permalink
Retry fetching GCS URL
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorcloudy committed May 10, 2023
1 parent 0d390e8 commit 2636f14
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion repositories/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,19 @@ func listDirectoriesInReleaseBucket(prefix string) ([]string, bool, error) {
if nextPageToken != "" {
url = fmt.Sprintf("%s&pageToken=%s", baseURL, nextPageToken)
}
content, _, err := httputil.ReadRemoteFile(url, "")

var content []byte
var err error
// Theoretically, this should always work, but we've seen transient
// errors on Bazel CI, so we retry a few times to work around this.
// https://github.com/bazelbuild/continuous-integration/issues/1627
for attempt := 0; attempt < 5; attempt++ {
content, _, err = httputil.ReadRemoteFile(url, "")
if err == nil {
break
}
}

if err != nil {
return nil, false, fmt.Errorf("could not list GCS objects at %s: %v", url, err)
}
Expand Down

0 comments on commit 2636f14

Please sign in to comment.