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

Enhance Proof Courier Handlers with Lazy Connection Attempts for HashMail and UniverseRPC #1092

Merged
merged 3 commits into from
Aug 22, 2024

Conversation

ffranr
Copy link
Contributor

@ffranr ffranr commented Aug 19, 2024

This PR introduces updates to the HashMail and UniverseRPC proof courier handlers, specifically making connection attempts optionally lazy. The changes are aimed at enhancing the robustness of the connection handling process by integrating these attempts into the backoff procedure where feasible.

@ffranr ffranr self-assigned this Aug 19, 2024
@coveralls
Copy link

coveralls commented Aug 19, 2024

Pull Request Test Coverage Report for Build 10506105341

Details

  • 3 of 183 (1.64%) changed or added relevant lines in 5 files are covered.
  • 23 unchanged lines in 7 files lost coverage.
  • Overall coverage decreased (-0.08%) to 40.336%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tapfreighter/chain_porter.go 0 1 0.0%
tapchannel/aux_sweeper.go 0 4 0.0%
proof/courier.go 1 176 0.57%
Files with Coverage Reduction New Missed Lines %
tapdb/addrs.go 2 79.04%
tappsbt/create.go 2 53.22%
commitment/tap.go 2 84.43%
asset/asset.go 2 81.54%
tapdb/universe.go 4 80.91%
tapgarden/caretaker.go 4 68.5%
tapdb/multiverse.go 7 60.32%
Totals Coverage Status
Change from base Build 10477817019: -0.08%
Covered Lines: 23953
Relevant Lines: 59383

💛 - Coveralls

@ffranr ffranr force-pushed the check-proof-courier-con branch from cd2dd0f to afe2b87 Compare August 20, 2024 17:21
@ffranr ffranr changed the title Lazily connect to hashmail service Enhance Proof Courier Handlers with Lazy Connection Attempts for HashMail and UniverseRPC Aug 20, 2024
@ffranr ffranr marked this pull request as ready for review August 20, 2024 17:25
@ffranr ffranr requested review from guggero and jharveyb August 20, 2024 17:26
@dstadulis dstadulis added this to the v0.4.2 milestone Aug 20, 2024
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Nice refactor! Looks good to me 🎉

proof/courier.go Show resolved Hide resolved
proof/courier.go Outdated Show resolved Hide resolved
proof/courier.go Outdated Show resolved Hide resolved
@ffranr ffranr force-pushed the check-proof-courier-con branch 2 times, most recently from 81353e7 to 9a021a1 Compare August 21, 2024 13:13
This commit updates the HashMail proof courier handler to make
connection attempts optionally lazy. Connection attempts are now
integrated into the backoff procedure where feasible, improving the
robustness of the connection handling process.
@ffranr ffranr force-pushed the check-proof-courier-con branch from 9a021a1 to 9756424 Compare August 21, 2024 13:43
Copy link
Contributor

@jharveyb jharveyb left a comment

Choose a reason for hiding this comment

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

Seems solid! Few comments:

  • Would be good for the initial sentence for commit 2 to be different from commit 1.
  • What's the recommended setup once this PR is in; should lazyConnect always be true?

From itests passing (including those using backoff) this is covered in testing, which is nice.

const (
// CourierConnStatusUnknown indicates that the connection status is
// unknown.
CourierConnStatusUnknown CourierConnStatus = iota
Copy link
Contributor

Choose a reason for hiding this comment

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

non-blocking nit: may be good to have unknown after disconnected, to follow the enum pattern we have elsewhere / make comparison a bit safer.

Though with exhaustive switches I suppose the order doesn't matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's a good idea to have unknown as the first enum value, ensuring that the default for a CourierConnStatus variable is unknown. Which means that if we don't set the field, it won't default to something opinionated.


// At this point, we know that the connection is not ready. We'll now
// attempt to establish a new connection to the courier service.
dialOpts, err := serverDialOpts()
Copy link
Contributor

Choose a reason for hiding this comment

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

You mentioned offline that you wanted the option for the connection setup to be blocking; I think adding the WithBlock() grpc.DialOption would work for that.

https://pkg.go.dev/google.golang.org/[email protected]#WithBlock

Copy link
Contributor Author

@ffranr ffranr Aug 22, 2024

Choose a reason for hiding this comment

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

That's what I've been playing around with in conjunction with DialContext 👍

@jharveyb jharveyb self-requested a review August 21, 2024 17:57
@ffranr
Copy link
Contributor Author

ffranr commented Aug 22, 2024

Would be good for the initial sentence for commit 2 to be different from commit 1.

@jharveyb I'm not sure what you mean. Should I make them different for clarity? I think you want the commit subject to be different. I've changes the second commit slightly.

What's the recommended setup once this PR is in; should lazyConnect always be true?

lazyConnect is currently true at each call site. I have a plan for a use case where it will be false.

@ffranr ffranr force-pushed the check-proof-courier-con branch from 9756424 to cbe2e2d Compare August 22, 2024 10:03
ffranr added 2 commits August 22, 2024 11:09
This commit modifies the Universe RPC proof courier handler to allow
connection attempts to be optionally lazy. Connection attempts are now
integrated into the backoff procedure where feasible, improving the
robustness of the connection handling process.
@ffranr ffranr force-pushed the check-proof-courier-con branch from cbe2e2d to e514015 Compare August 22, 2024 10:09
@ffranr ffranr added this pull request to the merge queue Aug 22, 2024
Merged via the queue into main with commit e893dee Aug 22, 2024
17 checks passed
@guggero guggero deleted the check-proof-courier-con branch August 22, 2024 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

5 participants