Skip to content

Commit 18fa05f

Browse files
committed
fix: fix bug with current implemented healthchecks
1 parent 42af3cf commit 18fa05f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/CommunityToolkit.Aspire.Hosting.SurrealDb/SurrealDbBuilderExtensions.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using Aspire.Hosting.ApplicationModel;
5+
using CommunityToolkit.Aspire.SurrealDb;
56
using Microsoft.Extensions.DependencyInjection;
7+
using Microsoft.Extensions.Diagnostics.HealthChecks;
68
using SurrealDb.Net;
79
using System.Text;
810
using System.Text.Json;
@@ -186,8 +188,16 @@ public static IResourceBuilder<SurrealDbDatabaseResource> AddDatabase(
186188
string serverName = builder.Resource.Parent.Name;
187189

188190
string healthCheckKey = $"{serverName}_{namespaceName}_{name}_check";
189-
builder.ApplicationBuilder.Services.AddHealthChecks().AddSurreal(_ => surrealDbClient!, healthCheckKey);
190-
191+
// TODO : Bug to be fixed
192+
//builder.ApplicationBuilder.Services.AddHealthChecks().AddSurreal(_ => surrealDbClient!, healthCheckKey);
193+
builder.ApplicationBuilder.Services.AddHealthChecks().Add(new HealthCheckRegistration(
194+
name: healthCheckKey,
195+
_ => new SurrealDbHealthCheck(surrealDbClient!),
196+
failureStatus: null,
197+
tags: null
198+
)
199+
);
200+
191201
return builder.ApplicationBuilder.AddResource(surrealServerDatabase)
192202
.WithHealthCheck(healthCheckKey);
193203
}

0 commit comments

Comments
 (0)