-
Notifications
You must be signed in to change notification settings - Fork 14
feat: let connection pool watch for connection close #140
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
Merged
+388
−14
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…e can make util public. The ConnPool will probably move somewhere else in the longer term.
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh-blobs/pr/140/docs/iroh_blobs/ Last updated: 2025-08-28T07:54:44Z |
it seems to cause weird problems with cross test.
matheus23
reviewed
Aug 27, 2025
Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>
matheus23
approved these changes
Aug 28, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Let the per-connection actor watch for connection close. When the connection is closed the conn actor will tell the main actor to remove the per-conn actor, and the next connection attempt will get a new per-connection actor.
Also add an optional callback to wait for a connection to reach a certain state before handing it to the user. Implements #141
Breaking Changes
util::connection_pool::Config is no longer Copy
util::connection_pool::Config has a new field on_connected
util::connection_pool::PoolConnectError has a new variant OnConnectError
Notes & open questions
Note: there is a very low probability that a request to get a ConnectionRef will return the closed connection. But that is fine. If the connection is closed, all currently live ConnectionRefs will turn unusable anyway, what's one more? In connected state the actor will be very fast in handing out ConnectionRef, so the queue should never be full. The queue is mostly for waiting during connect.
Change checklist