diff --git a/src/Services/Podcasts/Podcast.API/Program.cs b/src/Services/Podcasts/Podcast.API/Program.cs index e340c1c..0d2b8c2 100644 --- a/src/Services/Podcasts/Podcast.API/Program.cs +++ b/src/Services/Podcasts/Podcast.API/Program.cs @@ -26,8 +26,7 @@ var queueConnectionString = builder.Configuration.GetConnectionString("FeedQueue builder.Services.AddSingleton(new QueueClient(queueConnectionString, "feed-queue")); builder.Services.AddHttpClient(); -builder.Services.AddTransient(); -builder.Services.AddHttpClient().AddHttpMessageHandler(); +builder.Services.AddHttpClient(); // Authentication and authorization-related services // Comment back in if testing authentication diff --git a/src/Services/Podcasts/Podcast.Infrastructure/Http/ShowClient.cs b/src/Services/Podcasts/Podcast.Infrastructure/Http/ShowClient.cs index 2f3860a..2790ecd 100644 --- a/src/Services/Podcasts/Podcast.Infrastructure/Http/ShowClient.cs +++ b/src/Services/Podcasts/Podcast.Infrastructure/Http/ShowClient.cs @@ -4,32 +4,20 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Podcast.Infrastructure.Http +namespace Podcast.Infrastructure.Http; + +public class ShowClient { - public class JitterHandler : DelegatingHandler + private readonly HttpClient _httpClient; + + public ShowClient(HttpClient httpClient) { - protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) - { - // Who would do such a thing?! - // TODO fix this horrible perf leak! - await Task.Delay(TimeSpan.FromMilliseconds(Random.Shared.NextInt64(50, 500))); - return await base.SendAsync(request, cancellationToken); - } + _httpClient = httpClient; } - public class ShowClient + public async Task CheckLink(string showLink) { - private readonly HttpClient _httpClient; - - public ShowClient(HttpClient httpClient) - { - _httpClient = httpClient; - } - - public async Task CheckLink(string showLink) - { - var response = await _httpClient.GetAsync(showLink, HttpCompletionOption.ResponseHeadersRead); - return response.IsSuccessStatusCode; - } + var response = await _httpClient.GetAsync(showLink, HttpCompletionOption.ResponseHeadersRead); + return response.IsSuccessStatusCode; } -} +} \ No newline at end of file