Skip to content

Commit

Permalink
Fixes issue #133 (#144)
Browse files Browse the repository at this point in the history
* Get rid of the cron.Parse error

* Fix tests
  • Loading branch information
mitchrodrigues authored and hoffoo committed Dec 9, 2019
1 parent c85b71e commit 61759fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion periodic_enqueuer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,13 @@ func TestPeriodicEnqueuerSpawn(t *testing.T) {
}

func appendPeriodicJob(pjs []*periodicJob, spec, jobName string) []*periodicJob {
sched, err := cron.Parse(spec)
p := cron.NewParser(cron.SecondOptional | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor)

sched, err := p.Parse(spec)
if err != nil {
panic(err)
}

pj := &periodicJob{jobName: jobName, spec: spec, schedule: sched}
return append(pjs, pj)
}
4 changes: 3 additions & 1 deletion worker_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ func (wp *WorkerPool) JobWithOptions(name string, jobOpts JobOptions, fn interfa
// Note that the first value is the seconds!
// If you have multiple worker pools on different machines, they'll all coordinate and only enqueue your job once.
func (wp *WorkerPool) PeriodicallyEnqueue(spec string, jobName string) *WorkerPool {
schedule, err := cron.Parse(spec)
p := cron.NewParser(cron.SecondOptional | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor)

schedule, err := p.Parse(spec)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 61759fb

Please sign in to comment.