mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Add RunUntil to the Reflector and Poller to allow early termination
This is useful for test suites where you want to kill your workers without having to run one test env per execution.
This commit is contained in:
6
pkg/client/cache/reflector.go
vendored
6
pkg/client/cache/reflector.go
vendored
@@ -72,6 +72,12 @@ func (r *Reflector) Run() {
|
||||
go util.Forever(func() { r.listAndWatch() }, r.period)
|
||||
}
|
||||
|
||||
// RunUntil starts a watch and handles watch events. Will restart the watch if it is closed.
|
||||
// RunUntil starts a goroutine and returns immediately. It will exit when stopCh is closed.
|
||||
func (r *Reflector) RunUntil(stopCh <-chan struct{}) {
|
||||
go util.Until(func() { r.listAndWatch() }, r.period, stopCh)
|
||||
}
|
||||
|
||||
func (r *Reflector) listAndWatch() {
|
||||
var resourceVersion string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user