Skip to content

Commit 5806411

Browse files
viveksynghalexellis
authored andcommitted
Update cron package to v3
This commit updates cron package version to v3 and uses github.com/robfig/cron/v3 instead of gopkg.in/robfig/cron.v2 Signed-off-by: Vivek Singh <[email protected]>
1 parent ba21b2c commit 5806411

File tree

20 files changed

+1280
-517
lines changed

20 files changed

+1280
-517
lines changed

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ require (
88
github.com/openfaas/faas v0.0.0-20190104165101-a65df4795bc6
99
github.com/openfaas/faas-provider v0.0.0-20181216160432-220324e98f5d // indirect
1010
github.com/pkg/errors v0.8.1
11-
gopkg.in/robfig/cron.v2 v2.0.0-20150107220207-be2e0b0deed5
11+
github.com/robfig/cron/v3 v3.0.0
12+
gopkg.in/robfig/cron.v2 v2.0.0-20150107220207-be2e0b0deed5 // indirect
1213
)

go.sum

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ github.com/openfaas/faas v0.0.0-20190104165101-a65df4795bc6 h1:eCf/7VwjpIOfLecWQ
66
github.com/openfaas/faas v0.0.0-20190104165101-a65df4795bc6/go.mod h1:E0m2rLup0Vvxg53BKxGgaYAGcZa3Xl+vvL7vSi5yQ14=
77
github.com/openfaas/faas-provider v0.0.0-20181216160432-220324e98f5d h1:mPAUhyVGlBfGVQQUngtyGEH9uidFUzq9R5QkrpqGJug=
88
github.com/openfaas/faas-provider v0.0.0-20181216160432-220324e98f5d/go.mod h1:W4OIp33RUOpR7wW+omJB/7GhIydRmYXvKf/VqUKI4yM=
9+
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
910
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
11+
github.com/robfig/cron/v3 v3.0.0 h1:kQ6Cb7aHOHTSzNVNEhmp8EcWKLb4CbiMW9h9VyIhO4E=
12+
github.com/robfig/cron/v3 v3.0.0/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
1013
gopkg.in/robfig/cron.v2 v2.0.0-20150107220207-be2e0b0deed5 h1:E846t8CnR+lv5nE+VuiKTDG/v1U2stad0QzddfJC7kY=
1114
gopkg.in/robfig/cron.v2 v2.0.0-20150107220207-be2e0b0deed5/go.mod h1:hiOFpYm0ZJbusNj2ywpbrXowU3G8U6GIQzqn2mw1UIE=

types/scheduler.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ import (
88
"log"
99

1010
"github.com/openfaas-incubator/connector-sdk/types"
11-
"gopkg.in/robfig/cron.v2"
11+
cron "github.com/robfig/cron/v3"
1212
)
1313

1414
// EntryID type redifined for this package
1515
type EntryID cron.EntryID
1616

17+
var standardParser = cron.NewParser(
18+
cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor,
19+
)
20+
1721
// Scheduler is an interface which talks with cron scheduler
1822
type Scheduler struct {
1923
main *cron.Cron
@@ -44,7 +48,7 @@ func (s *Scheduler) AddCronFunction(c CronFunction, invoker *types.Invoker) (Sch
4448
// NewScheduler returns a scheduler
4549
func NewScheduler() *Scheduler {
4650
return &Scheduler{
47-
cron.New(),
51+
cron.New(cron.WithParser(standardParser)),
4852
}
4953
}
5054

@@ -60,7 +64,7 @@ func (s *Scheduler) Remove(function ScheduledFunction) {
6064

6165
// CheckSchedule returns true if the schedule string is compliant with cron
6266
func CheckSchedule(schedule string) bool {
63-
_, err := cron.Parse(schedule)
67+
_, err := standardParser.Parse(schedule)
6468
return err == nil
6569
}
6670

vendor/github.com/robfig/cron/v3/README.md

Lines changed: 125 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/robfig/cron/v3/chain.go

Lines changed: 92 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)