TrueLayer / ginepro

A client-side gRPC channel implementation for tonic
Apache License 2.0
127 stars 24 forks source link

add endpoint middlewares #34

Open conradludgate opened 2 years ago

conradludgate commented 2 years ago

Addresses #31. Adds a new EndpointMiddleware trait and adds the with_endpoint_layer method to the LoadBalancedChannelBuilder. These middlewares are invoked on every SocketAddr that the lookup service discovers.

Usage:

let load_balanced_channel = LoadBalancedChannel::builder(("www.test.com", 5000))
        // set the concurrency limit for the endpoint
        .with_endpoint_layer(|endpoint: Endpoint| Some(endpoint.concurrency_limit(1)))
        // set the user agent for the endpoint
        .with_endpoint_layer(|endpoint: Endpoint| {
            endpoint.user_agent("my ginepro client").ok()
        })
        .channel()
        .await
        .unwrap();
jspeiser commented 3 months ago

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.