Is it possible to set a minimum connections count for HTTP Client pool?

83 Views Asked by At

I would like to known if it is possible to somehow specify the minimum number of connections for a pool that the system will strive to maintain on an ongoing basis?

For connection limiting I use MaxConnectionsPerServer property and it works fine, but I can't find something like MinConnectionsPerServer

Here is a code snippet for better understanding:

services.AddHttpClient<HttpClient>()
    .ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler
    {
        ConnectTimeout = TimeSpan.FromSeconds(2),
        MaxConnectionsPerServer = 100,
        PooledConnectionLifetime = TimeSpan.FromMilliseconds(-1),
        PooledConnectionIdleTimeout = TimeSpan.FromMilliseconds(-1)
    })
    .SetHandlerLifetime(TimeSpan.FromMilliseconds(-1));
0

There are 0 best solutions below