Skip to content

Commit b1880e1

Browse files
rklaehnmatheus23
andauthored
feat: let connection pool watch for connection close (n0-computer#140)
## 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 n0-computer#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 - [ ] Self-review. - [ ] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented. --------- Co-authored-by: Philipp Krüger <[email protected]>
1 parent 6d8541b commit b1880e1

File tree

1 file changed

+388
-14
lines changed

1 file changed

+388
-14
lines changed

0 commit comments

Comments
 (0)