-
Notifications
You must be signed in to change notification settings - Fork 2.5k
rpcclient: make shutdown interrupt in-flight POSTs #2451
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
base: master
Are you sure you want to change the base?
rpcclient: make shutdown interrupt in-flight POSTs #2451
Conversation
Pull Request Test Coverage Report for Build 21215011456Details
💛 - Coveralls |
jcvernaleo
left a comment
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.
Looks good.
OK
rpcclient/infrastructure.go
Outdated
| httpReq, err = http.NewRequestWithContext(ctx, "POST", httpURL, bodyReader) | ||
| if err != nil { | ||
| // We must observe the contract that shutdown returns ErrClientShutdown. | ||
| if errors.Is(err, context.Canceled) && errors.Is(context.Cause(ctx), ErrClientShutdown) { |
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.
This check is unneeded since http.NewRequestWithContext will never return a error that's of type context.Canceled.
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.
Removed in f87d914
|
Checked: 1: The added One nitpicky gripe is maybe the test could be commented better. Looks good overall except for that one unneeded check. |
Drop unreachable context-canceled mapping after request creation. Clarify the HTTP POST shutdown test flow with brief comments.
@kcalvinalvin thanks for your review. I've addressed your comments in f87d914 Can you re-review? |
Change Description
Modify the rpcclient http POST call to ensure that a shutdown immediately interrupts in-flight requests, which otherwise would have to wait until timeout.
This PR includes the change in #2450 as it is necessary to ensure interruption during Dial.
Steps to Test
The test suite has an added test to ensure this works.
Pull Request Checklist
Testing
Code Style and Documentation
📝 Please see our Contribution Guidelines for further guidance.