Add validation for empty cron expression

This commit adds validation for cron expressions in the DefaultTriggerScheduler class. The system now checks if the cron expression provided is empty and issues a warning if that's the case. This prevents attempts to schedule triggers with an empty cron expression, which would fail.
This commit is contained in:
Sipke Schoorstra 2024-05-29 23:49:40 +02:00
parent 51cd3fa851
commit efbfe8ea9a

View file

@ -70,6 +70,13 @@ public class DefaultTriggerScheduler(IWorkflowScheduler workflowScheduler, ISyst
{
var payload = trigger.GetPayload<CronTriggerPayload>();
var cronExpression = payload.CronExpression;
if (string.IsNullOrWhiteSpace(cronExpression))
{
_logger.LogWarning("Cron expression is empty. TriggerId: {TriggerId}. Skipping scheduling of this trigger", trigger.Id);
continue;
}
var input = new { CronExpression = cronExpression }.ToDictionary();
var request = new DispatchWorkflowDefinitionRequest
{