Skip to content

Commit e89ebec

Browse files
committed
Fix typo & use of service provider
Signed-off-by: Victor Chang <vicchang@nvidia.com>
1 parent 3bf4fae commit e89ebec

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

src/Plugins/MinIO/HealthCheckBuilder.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
using System;
1718
using Microsoft.Extensions.DependencyInjection;
1819
using Microsoft.Extensions.Diagnostics.HealthChecks;
1920
using Microsoft.Extensions.Logging;
@@ -28,17 +29,19 @@ public HealthCheckBuilder(string fullyQualifiedAssemblyName) : base(fullyQualifi
2829

2930
public override IHealthChecksBuilder Configure(
3031
IHealthChecksBuilder builder,
31-
IServiceProvider serviceProvider,
3232
HealthStatus? failureStatus = null,
3333
IEnumerable<string>? tags = null,
3434
TimeSpan? timeout = null)
3535
{
36-
var minioClientFactory = serviceProvider.GetRequiredService<IMinIoClientFactory>();
37-
var logger = serviceProvider.GetRequiredService<ILogger<MinIoHealthCheck>>();
3836

3937
builder.Add(new HealthCheckRegistration(
4038
ConfigurationKeys.StorageServiceName,
41-
new MinIoHealthCheck(minioClientFactory, logger),
39+
serviceProvider =>
40+
{
41+
var minioClientFactory = serviceProvider.GetRequiredService<IMinIoClientFactory>();
42+
var logger = serviceProvider.GetRequiredService<ILogger<MinIoHealthCheck>>();
43+
return new MinIoHealthCheck(minioClientFactory, logger);
44+
},
4245
failureStatus,
4346
tags,
4447
timeout));

src/Storage/HealthCheckRegistrationBase.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ private string ParseAssemblyName()
4949

5050
public abstract IHealthChecksBuilder Configure(
5151
IHealthChecksBuilder builder,
52-
IServiceProvider serviceProvider,
5352
HealthStatus? failureStatus = null,
5453
IEnumerable<string>? tags = null,
5554
TimeSpan? timeout = null);

src/Storage/IHealthChecksBuilderExtensions.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,24 @@ public static class IHealthChecksBuilderExtensions
3333
/// <param name="fullyQualifiedTypeName">Fully qualified type name of the service to use.</param>
3434
/// <returns>Instance of <see cref="IHealthChecksBuilder"/>.</returns>
3535
/// <exception cref="ConfigurationException"></exception>
36-
public static IHealthChecksBuilder AddMOnaiDeployStorageHealthCheck(
36+
public static IHealthChecksBuilder AddMonaiDeployStorageHealthCheck(
3737
this IHealthChecksBuilder builder,
38-
IServiceProvider serviceProvider,
3938
string fullyQualifiedTypeName,
4039
HealthStatus? failureStatus = null,
4140
IEnumerable<string>? tags = null,
4241
TimeSpan? timeout = null)
43-
=> AddMOnaiDeployStorageHealthCheck(builder, serviceProvider, fullyQualifiedTypeName, new FileSystem(), failureStatus, tags, timeout);
42+
=> AddMonaiDeployStorageHealthCheck(builder, fullyQualifiedTypeName, new FileSystem(), failureStatus, tags, timeout);
4443

4544
/// <summary>
4645
/// Configures health check for the MONAI Deploy Storage Service.
4746
/// </summary>
4847
/// <param name="builder">Instance of <see cref="IHealthChecksBuilder"/>.</param>
49-
/// <param name="serviceProvider">Instance of <see cref="IServiceProvider"/>.</param>
5048
/// <param name="fullyQualifiedTypeName">Fully qualified type name of the service to use.</param>
5149
/// <param name="fileSystem">Instance of <see cref="IFileSystem"/>.</param>
5250
/// <returns>Instance of <see cref="IHealthChecksBuilder"/>.</returns>
5351
/// <exception cref="ConfigurationException"></exception>
54-
public static IHealthChecksBuilder AddMOnaiDeployStorageHealthCheck(
52+
public static IHealthChecksBuilder AddMonaiDeployStorageHealthCheck(
5553
this IHealthChecksBuilder builder,
56-
IServiceProvider serviceProvider,
5754
string fullyQualifiedTypeName,
5855
IFileSystem fileSystem,
5956
HealthStatus? failureStatus = null,
@@ -83,7 +80,7 @@ public static IHealthChecksBuilder AddMOnaiDeployStorageHealthCheck(
8380
throw new ConfigurationException($"The configured type '{fullyQualifiedTypeName}' does not implement the {typeof(IStorageService).Name} interface.");
8481
}
8582

86-
healthCheckBuilder.Configure(builder, serviceProvider, failureStatus, tags, timeout);
83+
healthCheckBuilder.Configure(builder, failureStatus, tags, timeout);
8784

8885
AppDomain.CurrentDomain.AssemblyResolve -= resolveEventHandler;
8986
return builder;

0 commit comments

Comments
 (0)