Skip to content

Latest commit

 

History

History
13 lines (8 loc) · 617 Bytes

cron-schedule.org

File metadata and controls

13 lines (8 loc) · 617 Bytes

cron schedule

之前一直没转过弯来的一个问题:定时任务调度时,如果已经根据最近要执行的任务设置了 sleep 时间,如果现在新来一个任务怎么办?在 timewheel 和 crontab 里面都有这样的疑惑。

然后看到这个代码:https://github.com/robfig/cron/blob/master/cron.go#L279

有新任务直接唤醒,然后重新计算 sleep 时间不就行了?!

居然一直没想到这一点……