Skip to content

Commit

Permalink
Execute the export directly instead of waiting a full interval
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee Roy Manea committed Apr 19, 2024
1 parent 8c31be0 commit 429bcd0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions TraefikExporter/TraefikAcmeExporterService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ public TraefikAcmeExporterService(IConfiguration configuration)
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
TraefikAcmeExporter exporter = new TraefikAcmeExporter();
while (await _pdfImportTimer.WaitForNextTickAsync(cancellationToken: stoppingToken) &&
!stoppingToken.IsCancellationRequested)
do
{
if (!File.Exists(acmePath))
{
Console.Error.WriteLine($"File does not exists {acmePath}");
continue;
}

if (File.GetLastWriteTime(acmePath) is { } lastModified && lastModified.Ticks > Modified.Ticks)
{
Console.WriteLine($"Starting new export");
Expand All @@ -39,6 +38,6 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
Console.WriteLine($"No new changes since {Modified:hh:mm:ss - dd.MM.yyyy}");
}
}
} while (await _pdfImportTimer.WaitForNextTickAsync(cancellationToken: stoppingToken) && !stoppingToken.IsCancellationRequested);
}
}

0 comments on commit 429bcd0

Please sign in to comment.