From 89e5e81beab65ee0855ce698aaab7e8c4f430fa3 Mon Sep 17 00:00:00 2001 From: Matt Freeman Date: Wed, 4 May 2016 05:01:54 +0000 Subject: [PATCH] Handle possible error in client reflector run loops --- pkg/client/cache/reflector.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/client/cache/reflector.go b/pkg/client/cache/reflector.go index 392c6fbd910..6f5658f9c76 100644 --- a/pkg/client/cache/reflector.go +++ b/pkg/client/cache/reflector.go @@ -200,14 +200,22 @@ func extractStackCreator() (string, int, bool) { // Run starts a goroutine and returns immediately. func (r *Reflector) Run() { 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 goroutine and returns immediately. It will exit when stopCh is closed. func (r *Reflector) RunUntil(stopCh <-chan struct{}) { 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 (