Skip to content

Commit

Permalink
Update cron package to v3
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
viveksyngh authored and alexellis committed Jan 30, 2021
1 parent ba21b2c commit 5806411
Show file tree
Hide file tree
Showing 20 changed files with 1,280 additions and 517 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ require (
github.com/openfaas/faas v0.0.0-20190104165101-a65df4795bc6
github.com/openfaas/faas-provider v0.0.0-20181216160432-220324e98f5d // indirect
github.com/pkg/errors v0.8.1
gopkg.in/robfig/cron.v2 v2.0.0-20150107220207-be2e0b0deed5
github.com/robfig/cron/v3 v3.0.0
gopkg.in/robfig/cron.v2 v2.0.0-20150107220207-be2e0b0deed5 // indirect
)
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ github.com/openfaas/faas v0.0.0-20190104165101-a65df4795bc6 h1:eCf/7VwjpIOfLecWQ
github.com/openfaas/faas v0.0.0-20190104165101-a65df4795bc6/go.mod h1:E0m2rLup0Vvxg53BKxGgaYAGcZa3Xl+vvL7vSi5yQ14=
github.com/openfaas/faas-provider v0.0.0-20181216160432-220324e98f5d h1:mPAUhyVGlBfGVQQUngtyGEH9uidFUzq9R5QkrpqGJug=
github.com/openfaas/faas-provider v0.0.0-20181216160432-220324e98f5d/go.mod h1:W4OIp33RUOpR7wW+omJB/7GhIydRmYXvKf/VqUKI4yM=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/robfig/cron/v3 v3.0.0 h1:kQ6Cb7aHOHTSzNVNEhmp8EcWKLb4CbiMW9h9VyIhO4E=
github.com/robfig/cron/v3 v3.0.0/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
gopkg.in/robfig/cron.v2 v2.0.0-20150107220207-be2e0b0deed5 h1:E846t8CnR+lv5nE+VuiKTDG/v1U2stad0QzddfJC7kY=
gopkg.in/robfig/cron.v2 v2.0.0-20150107220207-be2e0b0deed5/go.mod h1:hiOFpYm0ZJbusNj2ywpbrXowU3G8U6GIQzqn2mw1UIE=
10 changes: 7 additions & 3 deletions types/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ import (
"log"

"github.com/openfaas-incubator/connector-sdk/types"
"gopkg.in/robfig/cron.v2"
cron "github.com/robfig/cron/v3"
)

// EntryID type redifined for this package
type EntryID cron.EntryID

var standardParser = cron.NewParser(
cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor,
)

// Scheduler is an interface which talks with cron scheduler
type Scheduler struct {
main *cron.Cron
Expand Down Expand Up @@ -44,7 +48,7 @@ func (s *Scheduler) AddCronFunction(c CronFunction, invoker *types.Invoker) (Sch
// NewScheduler returns a scheduler
func NewScheduler() *Scheduler {
return &Scheduler{
cron.New(),
cron.New(cron.WithParser(standardParser)),
}
}

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

// CheckSchedule returns true if the schedule string is compliant with cron
func CheckSchedule(schedule string) bool {
_, err := cron.Parse(schedule)
_, err := standardParser.Parse(schedule)
return err == nil
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
125 changes: 125 additions & 0 deletions vendor/github.com/robfig/cron/v3/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions vendor/github.com/robfig/cron/v3/chain.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5806411

Please sign in to comment.