feat(nextRunWorker): добавлен еще один backgroundWorker, который смотрит очередь, и пересчитывает nextRun для jobGroupId
This commit is contained in:
28
PARR.NextRunWorker/RabbitWorker.cs
Normal file
28
PARR.NextRunWorker/RabbitWorker.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user