mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
updating github.com/robfig/cron to v1.1.0
This commit is contained in:
parent
51177c1ebb
commit
c8051af3b9
4
go.mod
4
go.mod
@ -126,7 +126,7 @@ require (
|
|||||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
|
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
|
||||||
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275
|
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275
|
||||||
github.com/quobyte/api v0.1.2
|
github.com/quobyte/api v0.1.2
|
||||||
github.com/robfig/cron v0.0.0-20170309132418-df38d32658d8
|
github.com/robfig/cron v1.1.0
|
||||||
github.com/russross/blackfriday v1.5.2
|
github.com/russross/blackfriday v1.5.2
|
||||||
github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e // indirect
|
github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e // indirect
|
||||||
github.com/shurcooL/sanitized_anchor_name v0.0.0-20151028001915-10ef21a441db // indirect
|
github.com/shurcooL/sanitized_anchor_name v0.0.0-20151028001915-10ef21a441db // indirect
|
||||||
@ -380,7 +380,7 @@ replace (
|
|||||||
github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a
|
github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a
|
||||||
github.com/quobyte/api => github.com/quobyte/api v0.1.2
|
github.com/quobyte/api => github.com/quobyte/api v0.1.2
|
||||||
github.com/remyoudompheng/bigfft => github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446
|
github.com/remyoudompheng/bigfft => github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446
|
||||||
github.com/robfig/cron => github.com/robfig/cron v0.0.0-20170309132418-df38d32658d8
|
github.com/robfig/cron => github.com/robfig/cron v1.1.0
|
||||||
github.com/rubiojr/go-vhd => github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c
|
github.com/rubiojr/go-vhd => github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c
|
||||||
github.com/russross/blackfriday => github.com/russross/blackfriday v0.0.0-20151117072312-300106c228d5
|
github.com/russross/blackfriday => github.com/russross/blackfriday v0.0.0-20151117072312-300106c228d5
|
||||||
github.com/satori/go.uuid => github.com/satori/go.uuid v1.2.0
|
github.com/satori/go.uuid => github.com/satori/go.uuid v1.2.0
|
||||||
|
4
go.sum
4
go.sum
@ -350,8 +350,8 @@ github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R
|
|||||||
github.com/quobyte/api v0.1.2 h1:lPHLsuvtjFyk8WhC4uHoHRkScijIHcffTWBBP+YpzYo=
|
github.com/quobyte/api v0.1.2 h1:lPHLsuvtjFyk8WhC4uHoHRkScijIHcffTWBBP+YpzYo=
|
||||||
github.com/quobyte/api v0.1.2/go.mod h1:jL7lIHrmqQ7yh05OJ+eEEdHr0u/kmT1Ff9iHd+4H6VI=
|
github.com/quobyte/api v0.1.2/go.mod h1:jL7lIHrmqQ7yh05OJ+eEEdHr0u/kmT1Ff9iHd+4H6VI=
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
|
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
|
||||||
github.com/robfig/cron v0.0.0-20170309132418-df38d32658d8 h1:b904/jbnmYuSPd5ojGzVTLjKPVTSj3t/e1vEPiPGjEg=
|
github.com/robfig/cron v1.1.0 h1:jk4/Hud3TTdcrJgUOBgsqrZBarcxl6ADIjSC2iniwLY=
|
||||||
github.com/robfig/cron v0.0.0-20170309132418-df38d32658d8/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
|
github.com/robfig/cron v1.1.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
|
||||||
github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c h1:ht7N4d/B7Ezf58nvMNVF3OlvDlz9pp+WHVcRNS0nink=
|
github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c h1:ht7N4d/B7Ezf58nvMNVF3OlvDlz9pp+WHVcRNS0nink=
|
||||||
github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto=
|
github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto=
|
||||||
github.com/russross/blackfriday v0.0.0-20151117072312-300106c228d5 h1:+6eORf9Bt4C3Wjt91epyu6wvLW+P6+AEODb6uKgO+4g=
|
github.com/russross/blackfriday v0.0.0-20151117072312-300106c228d5 h1:+6eORf9Bt4C3Wjt91epyu6wvLW+P6+AEODb6uKgO+4g=
|
||||||
|
4
vendor/github.com/robfig/cron/README.md
generated
vendored
4
vendor/github.com/robfig/cron/README.md
generated
vendored
@ -1,2 +1,6 @@
|
|||||||
[](http://godoc.org/github.com/robfig/cron)
|
[](http://godoc.org/github.com/robfig/cron)
|
||||||
[](https://travis-ci.org/robfig/cron)
|
[](https://travis-ci.org/robfig/cron)
|
||||||
|
|
||||||
|
# cron
|
||||||
|
|
||||||
|
Documentation here: https://godoc.org/github.com/robfig/cron
|
||||||
|
32
vendor/github.com/robfig/cron/cron.go
generated
vendored
32
vendor/github.com/robfig/cron/cron.go
generated
vendored
@ -165,11 +165,11 @@ func (c *Cron) runWithRecovery(j Job) {
|
|||||||
j.Run()
|
j.Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the scheduler.. this is private just due to the need to synchronize
|
// Run the scheduler. this is private just due to the need to synchronize
|
||||||
// access to the 'running' state variable.
|
// access to the 'running' state variable.
|
||||||
func (c *Cron) run() {
|
func (c *Cron) run() {
|
||||||
// Figure out the next activation times for each entry.
|
// Figure out the next activation times for each entry.
|
||||||
now := time.Now().In(c.location)
|
now := c.now()
|
||||||
for _, entry := range c.entries {
|
for _, entry := range c.entries {
|
||||||
entry.Next = entry.Schedule.Next(now)
|
entry.Next = entry.Schedule.Next(now)
|
||||||
}
|
}
|
||||||
@ -178,45 +178,46 @@ func (c *Cron) run() {
|
|||||||
// Determine the next entry to run.
|
// Determine the next entry to run.
|
||||||
sort.Sort(byTime(c.entries))
|
sort.Sort(byTime(c.entries))
|
||||||
|
|
||||||
var effective time.Time
|
var timer *time.Timer
|
||||||
if len(c.entries) == 0 || c.entries[0].Next.IsZero() {
|
if len(c.entries) == 0 || c.entries[0].Next.IsZero() {
|
||||||
// If there are no entries yet, just sleep - it still handles new entries
|
// If there are no entries yet, just sleep - it still handles new entries
|
||||||
// and stop requests.
|
// and stop requests.
|
||||||
effective = now.AddDate(10, 0, 0)
|
timer = time.NewTimer(100000 * time.Hour)
|
||||||
} else {
|
} else {
|
||||||
effective = c.entries[0].Next
|
timer = time.NewTimer(c.entries[0].Next.Sub(now))
|
||||||
}
|
}
|
||||||
|
|
||||||
timer := time.NewTimer(effective.Sub(now))
|
for {
|
||||||
select {
|
select {
|
||||||
case now = <-timer.C:
|
case now = <-timer.C:
|
||||||
now = now.In(c.location)
|
now = now.In(c.location)
|
||||||
// Run every entry whose next time was this effective time.
|
// Run every entry whose next time was less than now
|
||||||
for _, e := range c.entries {
|
for _, e := range c.entries {
|
||||||
if e.Next != effective {
|
if e.Next.After(now) || e.Next.IsZero() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
go c.runWithRecovery(e.Job)
|
go c.runWithRecovery(e.Job)
|
||||||
e.Prev = e.Next
|
e.Prev = e.Next
|
||||||
e.Next = e.Schedule.Next(now)
|
e.Next = e.Schedule.Next(now)
|
||||||
}
|
}
|
||||||
continue
|
|
||||||
|
|
||||||
case newEntry := <-c.add:
|
case newEntry := <-c.add:
|
||||||
|
timer.Stop()
|
||||||
|
now = c.now()
|
||||||
|
newEntry.Next = newEntry.Schedule.Next(now)
|
||||||
c.entries = append(c.entries, newEntry)
|
c.entries = append(c.entries, newEntry)
|
||||||
newEntry.Next = newEntry.Schedule.Next(time.Now().In(c.location))
|
|
||||||
|
|
||||||
case <-c.snapshot:
|
case <-c.snapshot:
|
||||||
c.snapshot <- c.entrySnapshot()
|
c.snapshot <- c.entrySnapshot()
|
||||||
|
continue
|
||||||
|
|
||||||
case <-c.stop:
|
case <-c.stop:
|
||||||
timer.Stop()
|
timer.Stop()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'now' should be updated after newEntry and snapshot cases.
|
break
|
||||||
now = time.Now().In(c.location)
|
}
|
||||||
timer.Stop()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,3 +252,8 @@ func (c *Cron) entrySnapshot() []*Entry {
|
|||||||
}
|
}
|
||||||
return entries
|
return entries
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// now returns current time in c location
|
||||||
|
func (c *Cron) now() time.Time {
|
||||||
|
return time.Now().In(c.location)
|
||||||
|
}
|
||||||
|
10
vendor/github.com/robfig/cron/doc.go
generated
vendored
10
vendor/github.com/robfig/cron/doc.go
generated
vendored
@ -78,22 +78,22 @@ You may use one of several pre-defined schedules in place of a cron expression.
|
|||||||
----- | ----------- | -------------
|
----- | ----------- | -------------
|
||||||
@yearly (or @annually) | Run once a year, midnight, Jan. 1st | 0 0 0 1 1 *
|
@yearly (or @annually) | Run once a year, midnight, Jan. 1st | 0 0 0 1 1 *
|
||||||
@monthly | Run once a month, midnight, first of month | 0 0 0 1 * *
|
@monthly | Run once a month, midnight, first of month | 0 0 0 1 * *
|
||||||
@weekly | Run once a week, midnight on Sunday | 0 0 0 * * 0
|
@weekly | Run once a week, midnight between Sat/Sun | 0 0 0 * * 0
|
||||||
@daily (or @midnight) | Run once a day, midnight | 0 0 0 * * *
|
@daily (or @midnight) | Run once a day, midnight | 0 0 0 * * *
|
||||||
@hourly | Run once an hour, beginning of hour | 0 0 * * * *
|
@hourly | Run once an hour, beginning of hour | 0 0 * * * *
|
||||||
|
|
||||||
Intervals
|
Intervals
|
||||||
|
|
||||||
You may also schedule a job to execute at fixed intervals. This is supported by
|
You may also schedule a job to execute at fixed intervals, starting at the time it's added
|
||||||
formatting the cron spec like this:
|
or cron is run. This is supported by formatting the cron spec like this:
|
||||||
|
|
||||||
@every <duration>
|
@every <duration>
|
||||||
|
|
||||||
where "duration" is a string accepted by time.ParseDuration
|
where "duration" is a string accepted by time.ParseDuration
|
||||||
(http://golang.org/pkg/time/#ParseDuration).
|
(http://golang.org/pkg/time/#ParseDuration).
|
||||||
|
|
||||||
For example, "@every 1h30m10s" would indicate a schedule that activates every
|
For example, "@every 1h30m10s" would indicate a schedule that activates after
|
||||||
1 hour, 30 minutes, 10 seconds.
|
1 hour, 30 minutes, 10 seconds, and then every interval after that.
|
||||||
|
|
||||||
Note: The interval does not take the job runtime into account. For example,
|
Note: The interval does not take the job runtime into account. For example,
|
||||||
if a job takes 3 minutes to run, and it is scheduled to run every 5 minutes,
|
if a job takes 3 minutes to run, and it is scheduled to run every 5 minutes,
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -722,7 +722,7 @@ github.com/prometheus/procfs/nfs
|
|||||||
github.com/prometheus/procfs/xfs
|
github.com/prometheus/procfs/xfs
|
||||||
# github.com/quobyte/api v0.1.2 => github.com/quobyte/api v0.1.2
|
# github.com/quobyte/api v0.1.2 => github.com/quobyte/api v0.1.2
|
||||||
github.com/quobyte/api
|
github.com/quobyte/api
|
||||||
# github.com/robfig/cron v0.0.0-20170309132418-df38d32658d8 => github.com/robfig/cron v0.0.0-20170309132418-df38d32658d8
|
# github.com/robfig/cron v1.1.0 => github.com/robfig/cron v1.1.0
|
||||||
github.com/robfig/cron
|
github.com/robfig/cron
|
||||||
# github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c => github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c
|
# github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c => github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c
|
||||||
github.com/rubiojr/go-vhd/vhd
|
github.com/rubiojr/go-vhd/vhd
|
||||||
|
Loading…
Reference in New Issue
Block a user