Skip to content
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

Enable custom RetryOptions to be specified per API call #7343

Merged
merged 7 commits into from Feb 18, 2020

Conversation

jhendrixMSFT
Copy link
Member

@jhendrixMSFT jhendrixMSFT commented Feb 13, 2020

Added WithRetryOptions() that adds a custom RetryOptions to the provided
context, allowing custom settings per API call.
Remove 429 from the list of default HTTP status codes for retry.
Change StatusCodesForRetry to a slice so consumers can append to it.

Added WithRetryOptions() that adds a custom RetryOptions to the provided
context, allowing custom settings per API call.
Remove 429 from the list of default HTTP status codes for retry.
Change StatusCodesForRetry to a slice so consumers can append to it.
Copy link
Member

@catalinaperalta catalinaperalta left a comment

LGTM

Copy link
Member

@catalinaperalta catalinaperalta left a comment

Still lgtm!

sdk/azcore/policy_retry.go Outdated Show resolved Hide resolved
sdk/azcore/policy_retry.go Outdated Show resolved Hide resolved
sdk/azcore/policy_retry.go Outdated Show resolved Hide resolved

// ContextWithRetryOptions adds the specified RetryOptions to the parent context.
// Use this to specify custom RetryOptions at the API-call level.
func ContextWithRetryOptions(parent context.Context, options RetryOptions) context.Context {
Copy link
Member

@JeffreyRichter JeffreyRichter Feb 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to WithRetryOptions (no Context) to match WithValue, WithDeadline, etc.

Copy link
Member Author

@jhendrixMSFT jhendrixMSFT Feb 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally I had it without the Context prefix however it seemed a big vague (i.e. azcore.WithRetryOptions()). Your examples are functions in the context package so you get names like context.WithValue() which is clear. I can remove the Context prefix if we think having the parent context being the first parameter is clear enough.

sdk/azcore/policy_retry.go Outdated Show resolved Hide resolved
sdk/azcore/policy_retry.go Outdated Show resolved Hide resolved
sdk/azcore/request.go Show resolved Hide resolved
sdk/azcore/response.go Show resolved Hide resolved
@jhendrixMSFT jhendrixMSFT merged commit 45732a6 into Azure:master Feb 18, 2020
3 checks passed
@jhendrixMSFT jhendrixMSFT deleted the retryoptions branch Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants