Begin a controller framework.

This commit is contained in:
Daniel Smith
2015-02-27 16:49:51 -08:00
parent e03f035fdb
commit 3fe17b93cf
6 changed files with 399 additions and 0 deletions

View File

@@ -88,10 +88,14 @@ func logError(err error) {
}
// Forever loops forever running f every period. Catches any panics, and keeps going.
// Deprecated. Please use Until and pass NeverStop as the stopCh.
func Forever(f func(), period time.Duration) {
Until(f, period, nil)
}
// NeverStop may be passed to Until to make it never stop.
var NeverStop <-chan struct{} = make(chan struct{})
// 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.