mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Handle possible error in client reflector run loops
This commit is contained in:
parent
43b644ea6f
commit
89e5e81bea
12
pkg/client/cache/reflector.go
vendored
12
pkg/client/cache/reflector.go
vendored
@ -200,14 +200,22 @@ func extractStackCreator() (string, int, bool) {
|
|||||||
// Run starts a goroutine and returns immediately.
|
// Run starts a goroutine and returns immediately.
|
||||||
func (r *Reflector) Run() {
|
func (r *Reflector) Run() {
|
||||||
glog.V(3).Infof("Starting reflector %v (%s) from %s", r.expectedType, r.resyncPeriod, r.name)
|
glog.V(3).Infof("Starting reflector %v (%s) from %s", r.expectedType, r.resyncPeriod, r.name)
|
||||||
go wait.Until(func() { r.ListAndWatch(wait.NeverStop) }, r.period, wait.NeverStop)
|
go wait.Until(func() {
|
||||||
|
if err := r.ListAndWatch(wait.NeverStop); err != nil {
|
||||||
|
utilruntime.HandleError(err)
|
||||||
|
}
|
||||||
|
}, r.period, wait.NeverStop)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunUntil starts a watch and handles watch events. Will restart the watch if it is closed.
|
// 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.
|
// RunUntil starts a goroutine and returns immediately. It will exit when stopCh is closed.
|
||||||
func (r *Reflector) RunUntil(stopCh <-chan struct{}) {
|
func (r *Reflector) RunUntil(stopCh <-chan struct{}) {
|
||||||
glog.V(3).Infof("Starting reflector %v (%s) from %s", r.expectedType, r.resyncPeriod, r.name)
|
glog.V(3).Infof("Starting reflector %v (%s) from %s", r.expectedType, r.resyncPeriod, r.name)
|
||||||
go wait.Until(func() { r.ListAndWatch(stopCh) }, r.period, stopCh)
|
go wait.Until(func() {
|
||||||
|
if err := r.ListAndWatch(stopCh); err != nil {
|
||||||
|
utilruntime.HandleError(err)
|
||||||
|
}
|
||||||
|
}, r.period, stopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
Loading…
Reference in New Issue
Block a user