Bump github.com/go-co-op/gocron from 1.16.3 to 1.17.0 (#101)

Bumps [github.com/go-co-op/gocron](https://github.com/go-co-op/gocron) from 1.16.3 to 1.17.0.
- [Release notes](https://github.com/go-co-op/gocron/releases)
- [Commits](https://github.com/go-co-op/gocron/compare/v1.16.3...v1.17.0)

---
updated-dependencies:
- dependency-name: github.com/go-co-op/gocron
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2022-08-25 09:31:39 -07:00 committed by GitHub
parent 0aed6be877
commit df0b547e0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 8 deletions

2
go.mod
View File

@ -7,7 +7,7 @@ require (
github.com/contribsys/faktory v1.6.1
github.com/contribsys/faktory_worker_go v1.6.0
github.com/feditools/go-lib v0.16.4
github.com/go-co-op/gocron v1.16.3
github.com/go-co-op/gocron v1.17.0
github.com/go-fed/activity v1.0.0
github.com/go-fed/httpsig v1.1.0
github.com/go-playground/validator/v10 v10.11.0

4
go.sum
View File

@ -116,8 +116,8 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-co-op/gocron v1.16.3 h1:TVb0tfg4fTVdosC+vTzLc0FsPSQRJ+rudBPof+ofh8w=
github.com/go-co-op/gocron v1.16.3/go.mod h1:W/N9G7bntRo5fVQlmjncvqSt74jxCxHfjyHlgcB33T8=
github.com/go-co-op/gocron v1.17.0 h1:IixLXsti+Qo0wMvmn6Kmjp2csk2ykpkcL+EmHmST18w=
github.com/go-co-op/gocron v1.17.0/go.mod h1:IpDBSaJOVfFw7hXZuTag3SCSkqazXBBUkbQ1m1aesBs=
github.com/go-fed/activity v1.0.0 h1:j7w3auHZnVCjUcgA1mE+UqSOjFBhvW2Z2res3vNol+o=
github.com/go-fed/activity v1.0.0/go.mod h1:v4QoPaAzjWZ8zN2VFVGL5ep9C02mst0hQYHUpQwso4Q=
github.com/go-fed/httpsig v0.1.1-0.20190914113940-c2de3672e5b5/go.mod h1:T56HUNYZUQ1AGUzhAYPugZfp36sKApVnGBgKlIY+aIE=

View File

@ -3,7 +3,6 @@
// An in-process scheduler for periodic jobs that uses the builder pattern
// for configuration. gocron lets you run Golang functions periodically
// at pre-determined intervals using a simple, human-friendly syntax.
//
package gocron
import (

View File

@ -27,7 +27,8 @@ type Scheduler struct {
running bool // represents if the scheduler is running at the moment or not
time TimeWrapper // wrapper around time.Time
executor *executor // executes jobs passed via chan
timer func(d time.Duration, f func()) *time.Timer
executor *executor // executes jobs passed via chan
tags sync.Map // for storing tags when unique tags is set
@ -55,6 +56,7 @@ func NewScheduler(loc *time.Location) *Scheduler {
time: &trueTime{},
executor: &executor,
tagsUnique: false,
timer: afterFunc,
}
}
@ -569,7 +571,7 @@ func (s *Scheduler) runContinuous(job *Job) {
s.run(job)
}
job.setTimer(time.AfterFunc(next.duration, func() {
job.setTimer(s.timer(next.duration, func() {
if !next.dateTime.IsZero() {
for {
n := s.now().UnixNano() - next.dateTime.UnixNano()
@ -1303,6 +1305,13 @@ func (s *Scheduler) CustomTime(customTimeWrapper TimeWrapper) {
s.time = customTimeWrapper
}
// CustomTimer takes in a function that mirrors the time.AfterFunc
// This is used to mock the time.AfterFunc function used by the scheduler
// for testing long intervals in a short amount of time.
func (s *Scheduler) CustomTimer(customTimer func(d time.Duration, f func()) *time.Timer) {
s.timer = customTimer
}
func (s *Scheduler) StopBlockingChan() {
s.startBlockingStopChanMutex.Lock()
if s.startBlockingStopChan != nil {

View File

@ -25,3 +25,9 @@ func (t *trueTime) Unix(sec int64, nsec int64) time.Time {
func (t *trueTime) Sleep(d time.Duration) {
time.Sleep(d)
}
// afterFunc proxies the time.AfterFunc function.
// This allows it to be mocked for testing.
func afterFunc(d time.Duration, f func()) *time.Timer {
return time.AfterFunc(d, f)
}

4
vendor/modules.txt vendored
View File

@ -40,8 +40,8 @@ github.com/felixge/httpsnoop
# github.com/fsnotify/fsnotify v1.5.4
## explicit; go 1.16
github.com/fsnotify/fsnotify
# github.com/go-co-op/gocron v1.16.3
## explicit; go 1.17
# github.com/go-co-op/gocron v1.17.0
## explicit; go 1.19
github.com/go-co-op/gocron
# github.com/go-fed/activity v1.0.0
## explicit; go 1.12