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.
Ombi/src/Ombi.HealthChecks/Checks/BaseHealthCheck.cs

24 lines
748 B

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using System.Threading;
using System.Threading.Tasks;
namespace Ombi.HealthChecks.Checks
{
public abstract class BaseHealthCheck : IHealthCheck
{
private readonly IServiceScopeFactory _serviceScopeFactory;
public BaseHealthCheck(IServiceScopeFactory serviceScopeFactory)
{
_serviceScopeFactory = serviceScopeFactory;
}
public abstract Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default);
protected IServiceScope CreateScope()
{
return _serviceScopeFactory.CreateScope();
}
}
}