23 lines
655 B
C#
23 lines
655 B
C#
using Dlhis.Middle.Entities;
|
|
using Dlhis.Middle.Services;
|
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
|
|
|
namespace Dlhis.Middle.BackgroundServices;
|
|
|
|
public class HealthCheckBackgroundService : BackgroundService
|
|
{
|
|
private readonly IHealthCheckService _healthCheckService;
|
|
|
|
public HealthCheckBackgroundService(IHealthCheckService healthCheckService)
|
|
{
|
|
_healthCheckService = healthCheckService;
|
|
}
|
|
|
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
{
|
|
while (!stoppingToken.IsCancellationRequested)
|
|
{
|
|
await _healthCheckService.DoHealthCheckAsync();
|
|
}
|
|
}
|
|
} |