-
Notifications
You must be signed in to change notification settings - Fork 720
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
client/http, retry: support backoffer in HTTP client #7680
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #7680 +/- ##
==========================================
- Coverage 73.72% 73.59% -0.14%
==========================================
Files 429 429
Lines 47379 47433 +54
==========================================
- Hits 34931 34909 -22
- Misses 9439 9541 +102
+ Partials 3009 2983 -26
Flags with carried forward coverage won't be shown. Click here to find out more. |
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.
rest lgtm
@@ -92,6 +93,8 @@ type Client interface { | |||
// Additionally, it is important for the caller to handle the content of the response body properly | |||
// in order to ensure that it can be read and marshaled correctly into `res`. | |||
WithRespHandler(func(resp *http.Response, res interface{}) error) Client | |||
// WithBackoffer sets and returns a new client with the given backoffer. | |||
WithBackoffer(*retry.Backoffer) Client |
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.
I prefer caller use ClientOption
in NewClient
to set 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.
Using WithBackoffer
here allows us to flexibly use different Backoffer
s for different scenarios and interfaces like:
cli := NewClient()
cli.WithBackoffer(bo1).GetRegion()
cli.WithBackoffer(bo2).GetStore()
If we useClientOption
for initialization, we may need to create a new Client
every time we want to use a different Backoffer
.
@lance6716: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
f539e0f
to
63884b9
Compare
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
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.
The rest LGTM
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2867a9f
to
cd119aa
Compare
/merge |
@JmPotato: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: cd119aa
|
ref tikv#7300 Support backoffer in HTTP client. Signed-off-by: JmPotato <ghzpotato@gmail.com> Signed-off-by: pingandb <songge102@pingan.com.cn>
ref tikv#7300 Support backoffer in HTTP client. Signed-off-by: JmPotato <ghzpotato@gmail.com>
What problem does this PR solve?
Issue Number: ref #7300, #7673.
What is changed and how does it work?
Check List
Tests
Release note