jamesmh / coravel

Near-zero config .NET library that makes advanced application features like Task Scheduling, Caching, Queuing, Event Broadcasting, and more a breeze!
https://docs.coravel.net/Installation/
MIT License
3.91k stars 257 forks source link

'?' not accepted as dayOfWeek #396

Closed bdenuit closed 3 months ago

bdenuit commented 3 months ago

Describe the bug When scheduling a task with the cron expression '15 6 1 * ?', Coravel throws an exception on the ? part -> Cron entry '?' is malformed.
And then afterwards the scheduled task crashes because it doesn't have an expression.

Affected Coravel Feature Scheduling

Expected behaviour This looks like a valid Cron expression to me. image (5)

jamesmh commented 3 months ago

"?" is technically considered a non-standard character, which is why it wasn't supported. It can mean different things depending on the implementation (e.g. there's no standard as far as exactly how it should behave).

Given it's "usually" equivalent to * in most situtations, you could replace the ? in your cron expressions with *.

Given it's non-standard, I lean on the side of not supporting it. For example, we could implement it and make it behave the exact same way as *. But then there are other behaviors that ? can have in some systems.... what do we do there?

So right now, I think your best bet is to just replace occurrences of ? with * in your cron expressions. If there's any other expected behavior, I would be curious to know - please let me know!

Thanks 😀

bdenuit commented 3 months ago

Ok thanks, I guess that makes sense. :)