Skip to content

Commit

Permalink
Log error in each loop it appears and fix wrong count of missed cluster.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangpengzhao committed Aug 1, 2016
1 parent dfd1227 commit 4ccd90d
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -725,23 +725,25 @@ func (s *ServiceController) lockedUpdateDNSRecords(service *cachedService, clust
return nil
}

var err error
missedCount := 0
ensuredCount := 0
unensuredCount := 0
for key := range s.clusterCache.clientMap {
for _, clusterName := range clusterNames {
if key == clusterName {
if err = s.ensureDnsRecords(clusterName, service); err != nil {
err := s.ensureDnsRecords(clusterName, service)
if err != nil {
unensuredCount += 1
glog.V(4).Infof("Failed to update DNS records for service %v from cluster %s: %v", service, clusterName, err)
} else {
ensuredCount += 1
}
} else {
missedCount += 1
}
}
}
missedCount := len(clusterNames) - ensuredCount - unensuredCount
if missedCount > 0 || unensuredCount > 0 {
return fmt.Errorf("Failed to update DNS records for %d clusters for service %v due to missing clients[missed count: %d] or ensuring DNS records error[unensured count: %d] %v",
len(clusterNames), service, missedCount, unensuredCount, err)
return fmt.Errorf("Failed to update DNS records for %d clusters for service %v due to missing clients [missed count: %d] and/or failing to ensure DNS records [unensured count: %d]",
len(clusterNames), service, missedCount, unensuredCount)
}
return nil
}
Expand Down

0 comments on commit 4ccd90d

Please sign in to comment.