Conversation
| uris2.lock().unwrap().push(endpoint.uri().clone()); | ||
| Some(endpoint) | ||
| }) | ||
| .with_endpoint_layer(|endpoint: Endpoint| endpoint.user_agent("my ginepro client").ok()) |
There was a problem hiding this comment.
Couldn't this cause a silent bug in the sense that the function fails but you still build the channel and your configuration is not applied as a consequence. My question is: do we want to the callback to return the error so the internals can fail the operation?
There was a problem hiding this comment.
It does! The function returns an Option<Endpoint>, returning None will short circuit, and if it can't build the endpoint, it won't be added to list of endpoints
There was a problem hiding this comment.
This functions the same as if you got your TLS config wrong. That does report a warning though. I'll see if I can make these convenient fn impls auto emit warnings
There was a problem hiding this comment.
I think I phrased my question wrong. Ideally these configurations should be verified before the builder succeeds, but that's impossible to do give the nature of the api and the protocol. Just wanted to clarify whether we're happy with that behavior: if you try to configure the endpoints but it consistently fails at runtime (for example tls_config or user_agent fails) no endpoints would be included. But as I'm writing this I don't see how we would handle it differently.
There was a problem hiding this comment.
Yeah the awkward thing is that this is only the probe service which runs in a background task. If it would error and close the probe loop, it would not effect the channel in any way.
I wonder if we can force the balanced channel to close in the event that the probe task closes
There was a problem hiding this comment.
What about making a wrapper type? only exposing the infallible methods? because Endpoint also has connect which we don't want anyone to call, and the tls config we already do internally in the lib. WDYT?
There was a problem hiding this comment.
@tl-helge-hoff are you asking for eagerly evaluated Endpoints or am I misinterpreting?
|
Is there any chance of this PR being merged? I've been investigating issues with very low-throughput connections and believe configuring endpoint settings might help. |
Addresses #31. Adds a new
EndpointMiddlewaretrait and adds thewith_endpoint_layermethod to theLoadBalancedChannelBuilder. These middlewares are invoked on everySocketAddrthat the lookup service discovers.Usage: