Fix namespace controller logging to be consistent

time.Now() was wrong, simplify namespace controller output
pull/6/head
Clayton Coleman 2017-05-17 17:43:44 -04:00
parent 4f35b31fc7
commit 7da310ea28
No known key found for this signature in database
GPG Key ID: 3D16906B4F1C5CB3
1 changed files with 5 additions and 5 deletions

View File

@ -155,7 +155,9 @@ func (nm *NamespaceController) worker() {
// syncNamespaceFromKey looks for a namespace with the specified key in its store and synchronizes it
func (nm *NamespaceController) syncNamespaceFromKey(key string) (err error) {
startTime := time.Now()
defer glog.V(4).Infof("Finished syncing namespace %q (%v)", key, time.Now().Sub(startTime))
defer func() {
glog.V(4).Infof("Finished syncing namespace %q (%v)", key, time.Now().Sub(startTime))
}()
namespace, err := nm.lister.Get(key)
if errors.IsNotFound(err) {
@ -174,16 +176,14 @@ func (nm *NamespaceController) Run(workers int, stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
defer nm.queue.ShutDown()
glog.Info("Starting namespace controller")
defer glog.Infof("Shutting down namespace controller")
if !controller.WaitForCacheSync("namespace", stopCh, nm.listerSynced) {
return
}
glog.V(5).Info("Starting workers")
for i := 0; i < workers; i++ {
go wait.Until(nm.worker, time.Second, stopCh)
}
<-stopCh
glog.V(1).Infof("Shutting down")
}