feat(aihitRelationshipsSyncer): Реализована логика синхронизации связей между Unit+CI/CD
This commit is contained in:
27
PARR.AIHITRelationshipsSyncerWorker/Worker.cs
Normal file
27
PARR.AIHITRelationshipsSyncerWorker/Worker.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using PARR.AIHITRelationshipsSyncer;
|
||||
|
||||
namespace PARR.AIHITRelationshipsSyncerWorker;
|
||||
|
||||
public class Worker : BackgroundService
|
||||
{
|
||||
private readonly IServiceProvider serviceProvider;
|
||||
|
||||
public Worker(IServiceProvider serviceProvider)
|
||||
{
|
||||
this.serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
using (var scope = serviceProvider.CreateScope())
|
||||
{
|
||||
var relationshipsSyncer = scope.ServiceProvider.GetService<IRelationshipsSyncer>();
|
||||
|
||||
if (relationshipsSyncer == null)
|
||||
throw new Exception($"<22><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> {nameof(IRelationshipsSyncer)}");
|
||||
|
||||
await relationshipsSyncer.StartAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user