руфдер

This commit is contained in:
kislovdm
2026-03-10 15:52:32 +03:00
parent 808eebb7c7
commit d7443883cd
6 changed files with 95 additions and 8 deletions
+10 -1
View File
@@ -10,23 +10,32 @@ public class DealService
private readonly IDealRepository _repository;
private readonly ITelegramNotifier _notifier;
private readonly ILogger<DealService> _logger;
private readonly IHealthMonitor _healthMonitor;
public DealService(
IPepperClient pepperClient,
IDealRepository repository,
ITelegramNotifier notifier,
ILogger<DealService> logger)
ILogger<DealService> logger,
IHealthMonitor healthMonitor)
{
_pepperClient = pepperClient;
_repository = repository;
_notifier = notifier;
_logger = logger;
_healthMonitor = healthMonitor;
}
public async Task CheckAndNotifyAsync(CancellationToken cancellationToken)
{
var deals = await _pepperClient.GetLatestDealsAsync(cancellationToken);
// Хелсчек: успешный запрос, вернувший более одной скидки (пусть и не новой)
if (deals.Count > 1)
{
_healthMonitor.ReportSuccess(DateTimeOffset.UtcNow);
}
foreach (var deal in deals)
{
if (await _repository.ExistsAsync(deal.Id, cancellationToken))