Adding an example of a HttpMessageHandler's Lifetime to 5 minutes in the pool. The default lifetime of HttpMessageHandler instances in the pool is 2 minutes.
This commit is contained in:
parent
460fc997af
commit
8844aaba75
@ -182,9 +182,12 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
||||
services.AddTransient<HttpClientAuthorizationDelegatingHandler>();
|
||||
services.AddTransient<HttpClientRequestIdDelegatingHandler>();
|
||||
|
||||
//add http client servicse
|
||||
services.AddHttpClient("extendedhandlerlifetime").SetHandlerLifetime(TimeSpan.FromMinutes(5));
|
||||
|
||||
//add http client services
|
||||
services.AddHttpClient<IBasketService, BasketService>()
|
||||
.AddHttpMessageHandler<HttpClientAuthorizationDelegatingHandler>()
|
||||
.SetHandlerLifetime(TimeSpan.FromMinutes(5)) //Sample. Default lifetime is 2 minutes
|
||||
.AddPolicyHandler(retriesWithExponentialBackoff)
|
||||
.AddPolicyHandler(circuitBreaker);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user