Cron: Bereich mit Schritt (7-22/3) lesen, ungueltige Ausdruecke im Scanner melden (#597)
Der Nachrichten-Digest im Dauerbetrieb der Test-VM lief nie: CronExpression verstand 'von-bis/schritt' nicht, TaskSchedule verschluckte den Fehler. Version 0.1.5. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,9 @@ public sealed class TaskScanner : IAsyncDisposable
|
||||
/// läuft jede Minute, die Meldung soll nicht mitlaufen.</summary>
|
||||
private readonly HashSet<string> _warnedTimeZones = [];
|
||||
|
||||
/// <summary>Aufgaben, deren ungültiger Cron-Ausdruck bereits gemeldet wurde.</summary>
|
||||
private readonly HashSet<string> _warnedCron = [];
|
||||
|
||||
private readonly CancellationTokenSource _cts = new();
|
||||
private Task? _loop;
|
||||
|
||||
@@ -173,6 +176,16 @@ public sealed class TaskScanner : IAsyncDisposable
|
||||
task.Id, task.Title, badZone);
|
||||
}
|
||||
|
||||
// Dasselbe für einen Cron-Ausdruck, den der Parser nicht versteht (#597).
|
||||
if (TaskSchedule.InvalidCron(task) is { } cronError
|
||||
&& _warnedCron.Add(task.Id))
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"Aufgabe {TaskId} ({Title}) hat den Termin cron \"{Cron}\", der nicht lesbar ist "
|
||||
+ "— sie wird nicht ausgeführt. {Fehler}",
|
||||
task.Id, task.Title, task.When!.Value, cronError);
|
||||
}
|
||||
|
||||
var occ = TaskSchedule.DueOccurrence(task, now);
|
||||
if (occ is null)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user