PARR.EsppTemplateSyncWorker
This commit is contained in:
40
PARR.EsppTemplateSyncWorker/Worker.cs
Normal file
40
PARR.EsppTemplateSyncWorker/Worker.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user