yuzd / Hangfire.HttpJob

httpjob for Hangfire,restful api for Hangfire,job调度与业务分离
https://github.com/yuzd/Hangfire.HttpJob/wiki
MIT License
628 stars 185 forks source link

定时执行怎么写,再wiki没看到 #51

Closed zhan520g closed 4 years ago

zhan520g commented 4 years ago

比如 某年某月某日某时某分某秒执行一个任务

zhan520g commented 4 years ago

只执行一次哦

yuzd commented 4 years ago

https://github.com/yuzd/Hangfire.HttpJob/wiki/01.%E5%A6%82%E4%BD%95%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E8%AE%A1%E5%88%92httpjob%E4%BB%BB%E5%8A%A1

先把 某年某月某日某时某分某秒 - 当前时间 = 分数 然后配置为DelayFromMinutes

需要注意的是 你精确到秒的画 hangfire调度的周期是需要配置1s配置一次 不同的storage不一样 mysql的话需要设置 SchedulePollingInterval 对于精确到s要求非常高 建议你用 redis作为storage