Skip to content

Commit

Permalink
Fixes --ECL
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Sep 6, 2023
1 parent 51214aa commit 166e46c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ public async Task<string> GetAuthTokenAsync(CancellationToken cancellationToken
return _authToken;
}

public override async Task StartAsync(CancellationToken cancellationToken)
{
await base.StartAsync(cancellationToken);
}

protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
_logger.LogInformation("ClearML Authentication Token Refresh service running - and has initial token.");
Expand All @@ -50,7 +45,8 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
while (!stoppingToken.IsCancellationRequested)
{
await Task.Delay(TimeSpan.FromSeconds(RefreshPeriod), stoppingToken);
await AuthorizeAsync(stoppingToken);
using (await _lock.LockAsync())
await AuthorizeAsync(stoppingToken);
}
}
catch (TaskCanceledException) { }
Expand Down
5 changes: 1 addition & 4 deletions src/SIL.Machine.AspNetCore/Services/ClearMLHealthCheck.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
public class ClearMLHealthCheck : IHealthCheck
{
private readonly IClearMLService _clearMLService;
private readonly ILogger _logger;

public ClearMLHealthCheck(IClearMLService clearMLService, ILoggerFactory loggerFactory)
public ClearMLHealthCheck(IClearMLService clearMLService)
{
_clearMLService = clearMLService;
_logger = loggerFactory.CreateLogger<ClearMLHealthCheck>();
}

public async Task<HealthCheckResult> CheckHealthAsync(
Expand All @@ -26,7 +24,6 @@ public async Task<HealthCheckResult> CheckHealthAsync(
}
catch (Exception e)
{
_logger.LogError(e, null);
return HealthCheckResult.Unhealthy(exception: e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public async Task CreateTaskAsync()
}
);
var authService = Substitute.For<IClearMLAuthenticationService>();
authService.GetAuthTokenAsync().Returns("accessToken");
authService.GetAuthTokenAsync().Returns(Task.FromResult("accessToken"));
var service = new ClearMLService(
mockHttp.ToHttpClient(),
options,
Expand Down

0 comments on commit 166e46c

Please sign in to comment.