-
Notifications
You must be signed in to change notification settings - Fork 849
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
Conversation
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.
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.
LGTM
Cleaned up some comments specific to storage.
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.
Still lgtm!
sdk/azcore/policy_retry.go
Outdated
|
||
// 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 { |
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.
Rename to WithRetryOptions (no Context) to match WithValue, WithDeadline, etc.
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.
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.
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.