limited commented on a change in pull request #1908: Changes for Backup Edge 
Cache Group
URL: 
https://github.com/apache/incubator-trafficcontrol/pull/1908#discussion_r171655350
 
 

 ##########
 File path: 
traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/router/TrafficRouter.java
 ##########
 @@ -675,17 +678,40 @@ public CacheLocation getCoverageZoneCacheLocation(final 
String ip, final String
                        return cacheLocation;
                }
 
-               // We had a hit in the CZF but the name does not match a known 
cache location.
-               // Check whether the CZF entry has a geolocation and use it if 
so.
-               return 
getClosestCacheLocation(cacheRegister.filterAvailableLocations(deliveryServiceId),
 networkNode.getGeolocation(), 
cacheRegister.getDeliveryService(deliveryServiceId));
+               if (networkNode.getBackupLoc() != null ) {
+                       for (final String element : networkNode.getBackupLoc()) 
{
+                               final CacheLocation bkCacheLocation = 
getCacheRegister().getCacheLocationById(element);
+                               if (bkCacheLocation != null && 
!getSupportingCaches(bkCacheLocation.getCaches(), deliveryService).isEmpty()) {
+                                       LOGGER.info("Got backup CZ cache group 
" + bkCacheLocation.getId() + " for " + ip + ", ds " + deliveryServiceId);
+                                       if (track != null) {
+                                               
track.setFromBackupCzGroup(true);
+                                       }
+                                       return bkCacheLocation;
+                               }
+                       }
+               } 
+
+               if ((networkNode.getBackupLoc() != null && 
networkNode.isUseClosest()) || (networkNode.getBackupLoc() == null)) {
 
 Review comment:
   ok, i'm trying to simplify this conditional, because its awkward to have 
opposite checks on both sides of an OR. Do we really need to check for 
`networkNode.getBackupLoc()` here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to