Skip to content

Commit 3b0a4ae

Browse files
authored
Merge pull request #112 from Project-MONAI/nds-health-check-fix
Nds health check fix
2 parents 4459654 + 0d792f2 commit 3b0a4ae

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/Plugins/AWSS3/StorageAdminService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ public class StorageAdminService : IStorageAdminService
3434
public Task<bool> HasConnectionAsync() => throw new NotImplementedException();
3535

3636
public Task RemoveUserAsync(string username) => throw new NotImplementedException();
37+
public Task<bool> SetConnectionAsync() => throw new NotImplementedException();
3738
}
3839
}

src/Plugins/MinIO/MinIoAdminHealthCheck.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@ public MinIoAdminHealthCheck(IStorageAdminService storageAdminService, ILogger<M
3636
{
3737
try
3838
{
39-
var hasConnection = await _storageAdminService.HasConnectionAsync();
40-
var connectionResult = await _storageAdminService.GetConnectionAsync();
39+
var hasConnection = await _storageAdminService.HasConnectionAsync().ConfigureAwait(false);
40+
if (hasConnection is false)
41+
{
42+
await _storageAdminService.SetConnectionAsync().ConfigureAwait(false);
43+
}
44+
45+
var connectionResult = await _storageAdminService.GetConnectionAsync().ConfigureAwait(false);
4146
var joinedResult = string.Join("\n", connectionResult);
4247

4348
var roDict = new ReadOnlyDictionary<string, object>(new Dictionary<string, object>() { { "MinoAdminResult", joinedResult } });

src/Storage/API/IStorageAdminService.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,11 @@ public interface IStorageAdminService
5656
/// </summary>
5757
/// <returns></returns>
5858
Task<bool> HasConnectionAsync();
59+
60+
/// <summary>
61+
/// Cread the Admin alias.
62+
/// </summary>
63+
/// <returns>Bool</returns>
64+
Task<bool> SetConnectionAsync();
5965
}
6066
}

0 commit comments

Comments
 (0)