coravel
coravel copied to clipboard
Run a scheduled task on a weekly basis, but specific day
Describe the solution you'd like I tried to setup Coravel to execute a job on a weekly basis, on Saturdays:
scheduler
.Schedule<MyJob>()
.Weekly()
.Saturday();
However, the task executed both at 12AM on Saturday and the next Monday, which was kind of unexpected.
I feel Weekly
could have an overload which accepts a day of the week as a new parameter in order to have the job being executed on the expected day. Rather than an overload, it could also be methods such as WeeklyAt
or WeeklyOn
, for a lack of a better name.
Describe alternatives you've considered
I could probably leverage the Cron
method with 0 0 * * SAT
(edit: it would be 0 0 * * 6
) instead, but I would prefer to let Coravel deal with CRON expressions.
Looking at Saturday
's restriction unit tests, it seems that I should also configure my scheduled job like this, but the combination of Daily
and Saturday
is rather odd:
scheduler
.Schedule<MyJob>()
.Daily()
.Saturday();