Quartz.net - Repeat on day n, of every m months?

旧街凉风 提交于 2019-11-28 14:31:24

It's not the way how the cron expression works. By defining it "9/5" you just expressed "start at september" and "icrement by 5 month" but there is no fourteenth month. Every month that exceed months count will be cutted so for example 1/5 will evaluate to "January" then "June" and lastly to "November". Another try will overflow months count and cron will start from the begining. So it will start from another "January", then "June" and lastly "November". Look at the expression, if it would work like you want, it wouldn't fit the expression in the next year becouse for example 1/5 would be evaluated in "April"

1/5 => January (2017) +5
1/5 => June (2017) +5
1/5 => November (2017) +5
1/5 => April (2018) +5

which is wrong! becouse April doesn't fit 1/5

This is correct behaviour:

1/5 => January (2017) +5
1/5 => June (2017) +5
1/5 => November (2017) +5
1/5 => January (2018) +5
1/5 => June (2018)
... 

What you really need is tool that works in a different way. I don't think there is some way to force Quartz.NET Cron to work as you want. The only way would be to "replace" Quartz.NET cron evaluator with something different. If you look around a bit, You could find library which I'm an author that implement small domain specific language that should be much more fitted for what you would like to do. I described it here: Evaluate complex time patterns

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!