From 5048464445d0a2cf8b37167122ffb22ca7c702b3 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Wed, 2 Sep 2015 16:49:05 -0700 Subject: [PATCH] Add Forever, syntactic sugar on Until --- pkg/util/util.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/util/util.go b/pkg/util/util.go index f75b59c709b..374389a0d79 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -94,6 +94,11 @@ func logError(err error) { // NeverStop may be passed to Until to make it never stop. 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. // Catches any panics, and keeps going. f may not be invoked if // stop channel is already closed. Pass NeverStop to Until if you