save progress
This commit is contained in:
@@ -9,17 +9,19 @@ public sealed class TimeAnchorHealthCheck : IHealthCheck
|
||||
{
|
||||
private readonly TimeStatusService _statusService;
|
||||
private readonly IOptions<AirGapOptions> _options;
|
||||
private readonly TimeProvider _timeProvider;
|
||||
|
||||
public TimeAnchorHealthCheck(TimeStatusService statusService, IOptions<AirGapOptions> options)
|
||||
public TimeAnchorHealthCheck(TimeStatusService statusService, IOptions<AirGapOptions> options, TimeProvider timeProvider)
|
||||
{
|
||||
_statusService = statusService;
|
||||
_options = options;
|
||||
_timeProvider = timeProvider;
|
||||
}
|
||||
|
||||
public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var opts = _options.Value;
|
||||
var status = await _statusService.GetStatusAsync(opts.TenantId, DateTimeOffset.UtcNow, cancellationToken);
|
||||
var status = await _statusService.GetStatusAsync(opts.TenantId, _timeProvider.GetUtcNow(), cancellationToken);
|
||||
|
||||
if (status.Anchor == TimeAnchor.Unknown)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user