mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.4 KiB
39 lines
1.4 KiB
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Threading.Tasks; |
|
using ErsatzTV.Core.Health; |
|
using ErsatzTV.Core.Health.Checks; |
|
using LanguageExt; |
|
|
|
namespace ErsatzTV.Infrastructure.Health |
|
{ |
|
public class HealthCheckService : IHealthCheckService |
|
{ |
|
private readonly List<IHealthCheck> _checks; |
|
|
|
// ReSharper disable SuggestBaseTypeForParameterInConstructor |
|
public HealthCheckService( |
|
IFFmpegVersionHealthCheck ffmpegVersionHealthCheck, |
|
IFFmpegReportsHealthCheck fFmpegReportsHealthCheck, |
|
IHardwareAccelerationHealthCheck hardwareAccelerationHealthCheck, |
|
IMovieMetadataHealthCheck movieMetadataHealthCheck, |
|
IEpisodeMetadataHealthCheck episodeMetadataHealthCheck, |
|
IZeroDurationHealthCheck zeroDurationHealthCheck, |
|
IVaapiDriverHealthCheck vaapiDriverHealthCheck) |
|
{ |
|
_checks = new List<IHealthCheck> |
|
{ |
|
ffmpegVersionHealthCheck, |
|
fFmpegReportsHealthCheck, |
|
hardwareAccelerationHealthCheck, |
|
movieMetadataHealthCheck, |
|
episodeMetadataHealthCheck, |
|
zeroDurationHealthCheck, |
|
vaapiDriverHealthCheck |
|
}; |
|
} |
|
|
|
public Task<List<HealthCheckResult>> PerformHealthChecks() => |
|
_checks.Map(c => c.Check()).Sequence().Map(results => results.ToList()); |
|
} |
|
}
|
|
|