Skip to content

Conversation

@wydengyre
Copy link
Contributor

@wydengyre wydengyre commented Oct 30, 2025

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

  • Your PR passes all CI checks.
  • Tests covering the positive and negative (error paths) are included.
  • Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

📝 Please see our Contribution Guidelines for further guidance.

@coveralls
Copy link

coveralls commented Oct 30, 2025

Pull Request Test Coverage Report for Build 21215011456

Details

  • 21 of 24 (87.5%) changed or added relevant lines in 1 file are covered.
  • 85 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.02%) to 54.972%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rpcclient/infrastructure.go 21 24 87.5%
Files with Coverage Reduction New Missed Lines %
btcutil/gcs/gcs.go 1 80.95%
rpcclient/infrastructure.go 84 48.49%
Totals Coverage Status
Change from base Build 20942501138: 0.02%
Covered Lines: 31217
Relevant Lines: 56787

💛 - Coveralls

Copy link
Member

@jcvernaleo jcvernaleo left a comment

Choose a reason for hiding this comment

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

Looks good.

OK

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) {
Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed in f87d914

@kcalvinalvin
Copy link
Collaborator

Checked:

1: The added TestHTTPPostShutdownInterruptsPendingRequest test is correct.
2: Sanity checked the changes in infrastructure.go.

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.
@wydengyre
Copy link
Contributor Author

Checked:

1: The added TestHTTPPostShutdownInterruptsPendingRequest test is correct. 2: Sanity checked the changes in infrastructure.go.

One nitpicky gripe is maybe the test could be commented better.

Looks good overall except for that one unneeded check.

@kcalvinalvin thanks for your review.

I've addressed your comments in f87d914

Can you re-review?

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.

4 participants