Quartz.NET 按每日计划向前推/向后拉时间
我最近接触到 Quartz.net,想知道设置每日(工作日)任务的最佳方法。假设每天下午 2 点到 5 点需要运行一堆任务,有时我想将其提前或推迟 30 分钟。
目前我正在考虑迭代所有每日计划的作业,并调整触发器。删除/重新创建。
I've recently come across Quartz.net, and would like to know the best approach on setting up daily (weekday) tasks. So let's say a bunch of tasks needs to run daily from 2-5pm, and at times I'd like to bring it forward, or push it back by 30 minutes.
At the moment I'm thinking of iterating through all the daily scheduled jobs, and adjusting the trigger. Delete/recreate.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想说你有两个选择:
重新安排作业的触发器。它基本上是删除+重新创建
触发器,但有一种方法可以为您做到这一点:
http://quartznet.sourceforge.net/apidoc/topic920.html
创建一份每天都会为你安排其他任务的工作
(或者每当您知道是否要更改时间时)。
这些工作可能会提前几天创造就业机会
如果您事先知道日程安排可能是什么。
如果日程安排的更改不经常发生,我会选择选项#1。另一方面,如果你经常改变时间表,我会选择#2。
I would say you have 2 options:
Reschedule the jobs' triggers. It's basically a delete+recreate of
the trigger, but there is a method that does it for you:
http://quartznet.sourceforge.net/apidoc/topic920.html
Create a job that will schedule the other tasks for you every day
(or whenever you know whether you want to change the time or not).
This jobs could potentially create jobs for several days in advance
if you know in advance what the schedule might be.
If the changes to the schedule don't happen very often, I'd go with option #1. If, on the other hand, you change the schedule often, I'd go with #2.