2025-08-06 10:33:55 +10:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2023-08-25 15:32:06 +10:00
|
|
|
using PARR.EsppTemplateSync;
|
2025-08-06 10:33:55 +10:00
|
|
|
using System;
|
2023-08-25 15:32:06 +10:00
|
|
|
|
|
|
|
|
namespace PARR.EsppTemplateSyncWorker
|
|
|
|
|
{
|
|
|
|
|
public class Worker : BackgroundService
|
|
|
|
|
{
|
|
|
|
|
private readonly ILogger<Worker> _logger;
|
2025-08-06 10:33:55 +10:00
|
|
|
private readonly ITemplateSyncer templateSyncer;
|
2023-08-25 15:32:06 +10:00
|
|
|
|
2023-09-01 16:19:32 +10:00
|
|
|
public Worker(
|
|
|
|
|
ILogger<Worker> logger,
|
2023-09-04 12:17:50 +10:00
|
|
|
ITemplateSyncer templateSyncer
|
2023-09-01 16:19:32 +10:00
|
|
|
)
|
2023-08-25 15:32:06 +10:00
|
|
|
{
|
|
|
|
|
_logger = logger;
|
2023-09-04 12:17:50 +10:00
|
|
|
this.templateSyncer = templateSyncer;
|
2023-08-25 15:32:06 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
|
|
|
{
|
2025-08-20 14:10:22 +10:00
|
|
|
await templateSyncer.StartAsync();
|
2023-08-25 15:32:06 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Task StopAsync(CancellationToken cancellationToken)
|
|
|
|
|
{
|
2025-08-20 14:10:22 +10:00
|
|
|
templateSyncer.StopAsync().Wait();
|
2023-08-25 15:32:06 +10:00
|
|
|
return base.StopAsync(cancellationToken);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|