feat(nextRunWorker): добавлен еще один backgroundWorker, который смотрит очередь, и пересчитывает nextRun для jobGroupId

This commit is contained in:
Mikhail Trubnikov
2026-02-27 14:05:25 +10:00
parent f7a2170454
commit 10bf68709b
16 changed files with 319 additions and 33 deletions

View File

@@ -0,0 +1,28 @@
using PARR.NextRun;
namespace PARR.NextRunWorker
{
public class RabbitWorker : BackgroundService
{
private readonly INextRunRabbitService nextRunRabbitService;
private readonly ILogger<RabbitWorker> logger;
public RabbitWorker(INextRunRabbitService nextRunRabbitService, ILogger<RabbitWorker> logger)
{
this.nextRunRabbitService = nextRunRabbitService;
this.logger = logger;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
logger.LogInformation("Запуск {workerName}", nameof(RabbitWorker));
await nextRunRabbitService.StopAsync();
}
public override Task StopAsync(CancellationToken cancellationToken)
{
nextRunRabbitService.StopAsync().Wait();
return base.StopAsync(cancellationToken);
}
}
}