From f689d44d258e7b46cd38161eaa34f81c679aa1f8 Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Mon, 18 Aug 2014 17:43:10 -0700 Subject: [PATCH] Add comment for clarity and logging for debugging. --- pkg/controller/replication_controller.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkg/controller/replication_controller.go b/pkg/controller/replication_controller.go index 90672868090..b39e863511a 100644 --- a/pkg/controller/replication_controller.go +++ b/pkg/controller/replication_controller.go @@ -116,13 +116,17 @@ func (rm *ReplicationManager) watchControllers(resourceVersion *uint64) { return } glog.Infof("Got watch: %#v", event) - if rc, ok := event.Object.(*api.ReplicationController); !ok { + rc, ok := event.Object.(*api.ReplicationController) + if !ok { glog.Errorf("unexpected object: %#v", event.Object) - } else { - // If we get disconnected, start where we left off. - *resourceVersion = rc.ResourceVersion + 1 - rm.syncHandler(*rc) + continue } + // If we get disconnected, start where we left off. + *resourceVersion = rc.ResourceVersion + 1 + // Sync even if this is a deletion event, to ensure that we leave + // it in the desired state. + glog.Infof("About to sync from watch: %v", rc.ID) + rm.syncHandler(*rc) } } } @@ -187,6 +191,7 @@ func (rm *ReplicationManager) synchronize() { for ix := range controllerSpecs { go func(ix int) { defer wg.Done() + glog.Infof("periodic sync of %v", controllerSpecs[ix].ID) err := rm.syncHandler(controllerSpecs[ix]) if err != nil { glog.Errorf("Error synchronizing: %#v", err)