-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Description:
The current implementation of the cron parser in src/SlimFaas/Jobs/Cron.cs does not handle expressions like 0/2 * * * * in the same way as modern cron parsers.
Expected behavior:
0/2 * * * * should be interpreted as */2 * * * *, meaning "every 2 minutes" (i.e., 0, 2, 4, ..., 58).
Actual behavior:
The parser treats 0/2 * * * * as "minute 0 of every hour" (equivalent to 0 * * * *), ignoring the step value.
Steps to reproduce:
Use the GetLatestJobExecutionTimestamp method with the cron definition 0/2 * * * *.
Observe that only minute 0 is considered, not every 2 minutes.
Relevant code:
Cron.ParseCronField (private static method)
Cron.GetLatestJobExecutionTimestamp (public static method)
Suggested fix: Update the parser logic to treat 0/2 as a range starting at 0, ending at 59, with a step of 2 (i.e., 0, 2, 4, ..., 58), matching the behavior of standard cron implementations.
Additional context:
Modern cron syntax allows both */2 and 0/2 for step values.
This affects scheduling accuracy and compatibility with other cron systems.