Skip to content

Commit

Permalink
Merge pull request #112 from Project-MONAI/nds-health-check-fix
Browse files Browse the repository at this point in the history
Nds health check fix
  • Loading branch information
neildsouth authored Nov 4, 2022
2 parents 4459654 + 0d792f2 commit 3b0a4ae
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Plugins/AWSS3/StorageAdminService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ public class StorageAdminService : IStorageAdminService
public Task<bool> HasConnectionAsync() => throw new NotImplementedException();

public Task RemoveUserAsync(string username) => throw new NotImplementedException();
public Task<bool> SetConnectionAsync() => throw new NotImplementedException();
}
}
9 changes: 7 additions & 2 deletions src/Plugins/MinIO/MinIoAdminHealthCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ public MinIoAdminHealthCheck(IStorageAdminService storageAdminService, ILogger<M
{
try
{
var hasConnection = await _storageAdminService.HasConnectionAsync();
var connectionResult = await _storageAdminService.GetConnectionAsync();
var hasConnection = await _storageAdminService.HasConnectionAsync().ConfigureAwait(false);
if (hasConnection is false)
{
await _storageAdminService.SetConnectionAsync().ConfigureAwait(false);
}

var connectionResult = await _storageAdminService.GetConnectionAsync().ConfigureAwait(false);
var joinedResult = string.Join("\n", connectionResult);

var roDict = new ReadOnlyDictionary<string, object>(new Dictionary<string, object>() { { "MinoAdminResult", joinedResult } });
Expand Down
6 changes: 6 additions & 0 deletions src/Storage/API/IStorageAdminService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,11 @@ public interface IStorageAdminService
/// </summary>
/// <returns></returns>
Task<bool> HasConnectionAsync();

/// <summary>
/// Cread the Admin alias.
/// </summary>
/// <returns>Bool</returns>
Task<bool> SetConnectionAsync();
}
}

0 comments on commit 3b0a4ae

Please sign in to comment.