34 lines
1014 B
C#
34 lines
1014 B
C#
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)
|
|
{
|
|
await templateSyncer.StartWatchingAsync();
|
|
|
|
//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);
|
|
}
|
|
}
|
|
} |