bump(github.com/robfig/cron): 783cfcb01fb00c48f740c9de79122bd410294149

This commit is contained in:
Maciej Szulik
2017-03-10 12:35:00 +01:00
parent 6522344bb0
commit 2fe190f838
4 changed files with 158 additions and 79 deletions

View File

@@ -1,5 +1,3 @@
// This library implements a cron spec parser and runner. See the README for
// more details.
package cron
import (
@@ -146,6 +144,15 @@ func (c *Cron) Start() {
go c.run()
}
// Run the cron scheduler, or no-op if already running.
func (c *Cron) Run() {
if c.running {
return
}
c.running = true
c.run()
}
func (c *Cron) runWithRecovery(j Job) {
defer func() {
if r := recover(); r != nil {
@@ -183,6 +190,7 @@ func (c *Cron) run() {
timer := time.NewTimer(effective.Sub(now))
select {
case now = <-timer.C:
now = now.In(c.location)
// Run every entry whose next time was this effective time.
for _, e := range c.entries {
if e.Next != effective {