PARR.EsppTemplateSyncWorker

This commit is contained in:
Mikhail Trubnikov
2023-08-25 15:32:06 +10:00
parent 17feefce02
commit e284b3ca19
17 changed files with 363 additions and 9 deletions

View File

@@ -0,0 +1,40 @@
using PARR.EsppTemplateSync;
namespace PARR.EsppTemplateSyncWorker
{
public class Worker : BackgroundService
{
private readonly ILogger<Worker> _logger;
private readonly ITemplateSyncer templateSyncer;
public Worker(ILogger<Worker> logger, ITemplateSyncer templateSyncer)
{
_logger = logger;
this.templateSyncer = templateSyncer;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
//var task = new Task(() =>
//{
// templateSyncer.StartWatching();
//});
//task.Start();
templateSyncer.StartWatching();
//while (!stoppingToken.IsCancellationRequested)
//{
// _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
// await Task.Delay(1 * 1000, stoppingToken);
//}
}
public override Task StopAsync(CancellationToken cancellationToken)
{
templateSyncer.StopWatching();
return base.StopAsync(cancellationToken);
}
}
}