Skip to content

Commit

Permalink
Don't use client factory in WithRedisInsights. (#6067)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchdenny authored Oct 3, 2024
1 parent f79f3a9 commit dfdc244
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
8 changes: 8 additions & 0 deletions playground/Redis/Redis.AppHost/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
9 changes: 9 additions & 0 deletions playground/Redis/Redis.AppHost/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Aspire.Hosting.Dcp": "Warning"
}
}
}
5 changes: 1 addition & 4 deletions src/Aspire.Hosting.Redis/RedisBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ public static IResourceBuilder<RedisResource> WithRedisInsight(this IResourceBui
}
else
{
builder.ApplicationBuilder.Services.AddHttpClient();
containerName ??= $"{builder.Resource.Name}-insight";

var resource = new RedisInsightResource(containerName);
Expand All @@ -165,12 +164,10 @@ public static IResourceBuilder<RedisResource> WithRedisInsight(this IResourceBui
return;
}

var httpClientFactory = e.Services.GetRequiredService<IHttpClientFactory>();

var redisInsightResource = builder.ApplicationBuilder.Resources.OfType<RedisInsightResource>().Single();
var insightEndpoint = redisInsightResource.PrimaryEndpoint;

var client = httpClientFactory.CreateClient();
using var client = new HttpClient();
client.BaseAddress = new Uri($"{insightEndpoint.Scheme}://{insightEndpoint.Host}:{insightEndpoint.Port}");

var rls = e.Services.GetRequiredService<ResourceLoggerService>();
Expand Down

0 comments on commit dfdc244

Please sign in to comment.