Adds Done() and Err() to pod controller (#735)
Allows callers to wait for pod controller exit in addition to readiness. This means the caller does not have to deal handling errors from the pod controller running in a gorutine since it can wait for exit via `Done()` and check the error with `Err()`
This commit is contained in:
@@ -27,9 +27,10 @@ There are two primary controllers, the node runner and the pod runner.
|
||||
|
||||
select {
|
||||
case <-podRunner.Ready():
|
||||
go nodeRunner.Run(ctx)
|
||||
case <-ctx.Done()
|
||||
return ctx.Err()
|
||||
case <-podRunner.Done():
|
||||
}
|
||||
if podRunner.Err() != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
After calling start, cancelling the passed in context will shutdown the
|
||||
|
||||
Reference in New Issue
Block a user