-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws/client: Adds configurations to the default retryer #2830
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4b955d7
adds configurations to the default retryer
skotambkar 04e6655
Merge branch 'master' into defRetryer
skotambkar af05af0
fixed failing tests
skotambkar a0a50bd
Fixed failing test
skotambkar fa3b32d
adds suggested changes
skotambkar e4f40bd
Merge branch 'master' into defRetryer
jasdel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
### SDK Features | ||
|
||
### SDK Enhancements | ||
* `aws/client`: Adds configurations to the default retryer ([#2830](https://github.com/aws/aws-sdk-go/pull/2830)) | ||
* Exposes members of the default retryer. Adds NoOpRetryer to support no retry behavior. | ||
* Updates the underlying logic used by the default retryer to calculate jittered delay for retry. | ||
* Fixes [#2829](https://github.com/aws/aws-sdk-go/issues/2829) | ||
* `aws`: Add value/pointer conversion functions for all basic number types ([#2740](https://github.com/aws/aws-sdk-go/pull/2740)) | ||
* Adds value and pointer conversion utilities for the remaining set of integer and float number types. | ||
|
||
### SDK Bugs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package client | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/aws/aws-sdk-go/aws/request" | ||
) | ||
|
||
// NoOpRetryer provides a retryer that performs no retries. | ||
// It should be used when we do not want retries to be performed. | ||
type NoOpRetryer struct{} | ||
|
||
// MaxRetries returns the number of maximum returns the service will use to make | ||
// an individual API; For NoOpRetryer the MaxRetries will always be zero. | ||
func (d NoOpRetryer) MaxRetries() int { | ||
return 0 | ||
} | ||
|
||
// ShouldRetry will always return false for NoOpRetryer, as it should never retry. | ||
func (d NoOpRetryer) ShouldRetry(_ *request.Request) bool { | ||
return false | ||
} | ||
|
||
// RetryRules returns the delay duration before retrying this request again; | ||
// since NoOpRetryer does not retry, RetryRules always returns 0. | ||
func (d NoOpRetryer) RetryRules(_ *request.Request) time.Duration { | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package client | ||
|
||
import ( | ||
"net/http" | ||
"testing" | ||
"time" | ||
|
||
"github.com/aws/aws-sdk-go/aws/request" | ||
) | ||
|
||
func TestNoOpRetryer(t *testing.T) { | ||
cases := []struct { | ||
r request.Request | ||
expectMaxRetries int | ||
expectRetryDelay time.Duration | ||
expectRetry bool | ||
}{ | ||
{ | ||
r: request.Request{ | ||
HTTPResponse: &http.Response{StatusCode: 200}, | ||
}, | ||
expectMaxRetries: 0, | ||
expectRetryDelay: 0, | ||
expectRetry: false, | ||
}, | ||
} | ||
|
||
d := NoOpRetryer{} | ||
for i, c := range cases { | ||
maxRetries := d.MaxRetries() | ||
retry := d.ShouldRetry(&c.r) | ||
retryDelay := d.RetryRules(&c.r) | ||
|
||
if e, a := c.expectMaxRetries, maxRetries; e != a { | ||
t.Errorf("%d: expected %v, but received %v for number of max retries", i, e, a) | ||
} | ||
|
||
if e, a := c.expectRetry, retry; e != a { | ||
t.Errorf("%d: expected %v, but received %v for should retry", i, e, a) | ||
} | ||
|
||
if e, a := c.expectRetryDelay, retryDelay; e != a { | ||
t.Errorf("%d: expected %v, but received %v as retry delay", i, e, a) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can update the doc string for this type to be more concise. The new delay members should have doc strings added to them that describe their default behavior as automatically being set of their value is 0.