-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Construct a Client that will lazily establish a connection #167
Comments
Sorry, this was closed wrong, the issue for reestablishing connections is fixed but to support lazy connections, the idea I have is to provide a method on |
Removing this from |
Yeah this isn't blocking me currently as I'm handling this by having a light wrapper around a tonic client atm. |
@bmwill got a link to that wrapper by chance? |
Yeah sure! Here's one example. |
We did a naive but simple implementation of this, found here. |
Adds a 'lazy' constructor which will not attempt to connect to the endpoint until first use. This is useful in situations where the connection is created when the remote service may temporarily not be responding, such as server startup. Fixes hyperium#167
Feature Request
Construct a Client that will lazily establish a connection
Motivation
Sometimes it would be useful to be able to construct a client and defer establishing a connection with a server until you make a request.
Proposal
Today when creating a client the connection with the server must be established before a client struct is returned from the
::connect()
function. Perhaps another constructor could be added which lazily connects and defers actually establishing the connection until a request is made.Its expected (at least to me) that a client already needs to know and understand how to reconnect to a server in the event of a broken connection so this shouldn't be much more difficult than handling that case.
cc: @LucioFranco
The text was updated successfully, but these errors were encountered: