* catch health check cancellation * local library scanner cleanup * emby and jf library scanner cleanup * rework emby movie library scanner * refactor emby movie library scanner * refactor jellyfin movie library scanner * clear etag until after new media has been processed * refactor plex movie library scanner * update changelog
27 lines
946 B
C#
27 lines
946 B
C#
using ErsatzTV.Core.Health;
|
|
|
|
namespace ErsatzTV.Application.Health;
|
|
|
|
public class GetAllHealthCheckResultsHandler : IRequestHandler<GetAllHealthCheckResults, List<HealthCheckResult>>
|
|
{
|
|
private readonly IHealthCheckService _healthCheckService;
|
|
|
|
public GetAllHealthCheckResultsHandler(IHealthCheckService healthCheckService) =>
|
|
_healthCheckService = healthCheckService;
|
|
|
|
public async Task<List<HealthCheckResult>> Handle(
|
|
GetAllHealthCheckResults request,
|
|
CancellationToken cancellationToken)
|
|
{
|
|
try
|
|
{
|
|
List<HealthCheckResult> results = await _healthCheckService.PerformHealthChecks(cancellationToken);
|
|
return results.Filter(r => r.Status != HealthCheckStatus.NotApplicable).ToList();
|
|
}
|
|
catch (Exception ex) when (ex is TaskCanceledException or OperationCanceledException)
|
|
{
|
|
return new List<HealthCheckResult>();
|
|
}
|
|
}
|
|
}
|