mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #13536 from brendandburns/util
Add Forever, syntactic sugar on Until
This commit is contained in:
commit
228517e634
@ -94,6 +94,11 @@ func logError(err error) {
|
|||||||
// NeverStop may be passed to Until to make it never stop.
|
// NeverStop may be passed to Until to make it never stop.
|
||||||
var NeverStop <-chan struct{} = make(chan struct{})
|
var NeverStop <-chan struct{} = make(chan struct{})
|
||||||
|
|
||||||
|
// Forever is syntactic sugar on top of Until
|
||||||
|
func Forever(f func(), period time.Duration) {
|
||||||
|
Until(f, period, NeverStop)
|
||||||
|
}
|
||||||
|
|
||||||
// Until loops until stop channel is closed, running f every period.
|
// Until loops until stop channel is closed, running f every period.
|
||||||
// Catches any panics, and keeps going. f may not be invoked if
|
// Catches any panics, and keeps going. f may not be invoked if
|
||||||
// stop channel is already closed. Pass NeverStop to Until if you
|
// stop channel is already closed. Pass NeverStop to Until if you
|
||||||
|
Loading…
Reference in New Issue
Block a user