Skip to content

Commit

Permalink
Increased retries (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpusok authored Sep 18, 2023
1 parent 19a3fb5 commit 26aa360
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.20
require (
github.com/bitrise-io/go-steputils v1.0.6
github.com/bitrise-io/go-utils v1.0.9
github.com/hashicorp/go-retryablehttp v0.7.4
github.com/stretchr/testify v1.8.4
golang.org/x/oauth2 v0.12.0
google.golang.org/api v0.141.0
Expand All @@ -21,7 +22,6 @@ require (
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions network.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ func createHTTPClient(jsonKeyPth string) (*http.Client, error) {
}

retryClient := retry.NewHTTPClient()
retryClient.RetryWaitMin = 2 * time.Second
retryClient.RetryMax = 6
retryClient.CheckRetry = func(ctx context.Context, resp *http.Response, err error) (bool, error) {
if resp != nil && resp.StatusCode == http.StatusUnauthorized {
log.Debugf("Received HTTP 401 (Unauthorized), retrying request...")
Expand Down
2 changes: 1 addition & 1 deletion vendor/golang.org/x/oauth2/jws/jws.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/golang.org/x/oauth2/token.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 26aa360

Please sign in to comment.