Skip to content

Commit

Permalink
Revert "Disable HttpClient's timeout for Standard Resilience and Hedg…
Browse files Browse the repository at this point in the history
…ing (#4862)" (#4925)

This reverts commit 3654748.
  • Loading branch information
joperezr committed Feb 7, 2024
1 parent 80abb8d commit b5c9f8d
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Net.Http;
using System.Threading;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Http.Resilience;
Expand Down Expand Up @@ -140,9 +139,6 @@ public static IStandardHedgingHandlerBuilder AddStandardHedgingHandler(this IHtt
})
.SelectPipelineByAuthority();

// Disable the HttpClient timeout to allow the timeout strategies to control the timeout.
_ = builder.ConfigureHttpClient(client => client.Timeout = Timeout.InfiniteTimeSpan);

return new StandardHedgingHandlerBuilder(builder.Name, builder.Services, routingBuilder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Threading;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Http.Resilience;
Expand Down Expand Up @@ -87,9 +86,6 @@ public static IHttpStandardResiliencePipelineBuilder AddStandardResilienceHandle
.AddTimeout(options.AttemptTimeout);
});

// Disable the HttpClient timeout to allow the timeout strategies to control the timeout.
_ = builder.ConfigureHttpClient(client => client.Timeout = Timeout.InfiniteTimeSpan);

return new HttpStandardResiliencePipelineBuilder(optionsName, builder.Services);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,6 @@ public async Task DynamicReloads_Ok()
AssertNoResponse();
}

[Fact]
public void AddStandardResilienceHandler_EnsureHttpClientTimeoutDisabled()
{
var client = CreateClientWithHandler();

client.Timeout.Should().Be(Timeout.InfiniteTimeSpan);
}

[Fact]
public async Task NoRouting_Ok()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using FluentAssertions;
using Microsoft.Extensions.Configuration;
Expand Down Expand Up @@ -235,16 +234,6 @@ public async Task DynamicReloads_Ok()
requests.Should().HaveCount(11);
}

[Fact]
public void AddStandardResilienceHandler_EnsureHttpClientTimeoutDisabled()
{
var builder = new ServiceCollection().AddLogging().AddMetrics().AddHttpClient("test").AddStandardHedgingHandler();

using var client = builder.Services.BuildServiceProvider().GetRequiredService<IHttpClientFactory>().CreateClient("test");

client.Timeout.Should().Be(Timeout.InfiniteTimeSpan);
}

private static void AddStandardResilienceHandler(
MethodArgs mode,
IHttpClientBuilder builder,
Expand Down

0 comments on commit b5c9f8d

Please sign in to comment.