You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2018/10/04 20:03:33 UTC

[GitHub] rawlinp commented on a change in pull request #2904: Do Not Merge - Adds support for single layer CDNs

rawlinp commented on a change in pull request #2904: Do Not Merge - Adds support for single layer CDNs
URL: https://github.com/apache/trafficcontrol/pull/2904#discussion_r222485771
 
 

 ##########
 File path: traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
 ##########
 @@ -2347,6 +2354,33 @@ sub parent_dot_config { #fix qstring - should be ignore for quika
 	my $server_obj = shift;
 	my $data;
 	my $server_type = $server_obj->type->name;
+	
+	## By default we're going to assume that our cache is not a top level cache (mids, edges without parents, etc.)
+	my $is_top_level_cache = 0;
+
+	## Look up parent cachegroup IDs.
+	my $parent_cachegroup_id =
 
 Review comment:
   all these DB queries and type-checking can be consolidated a bit like this (the one query returns all the data you need in one go):
   ```
   	my $cachegroup = $self->db->resultset('Cachegroup')->search( {'me.id' => $server_obj->cachegroup->id }, { prefetch => [ { 'parent_cachegroup' => 'type' }, { 'secondary_parent_cachegroup' => 'type' } ] })->single();
   	my $parent_type = defined($cachegroup->parent_cachegroup)? $cachegroup->parent_cachegroup->type->name : '';
   	my $secondary_parent_type = defined($cachegroup->secondary_parent_cachegroup)? $cachegroup->secondary_parent_cachegroup->type->name : '';
   	if (($parent_type eq '' || $parent_type  eq 'ORG_LOC')
   			&& ($secondary_parent_type eq '' || $secondary_parent_type eq 'ORG_LOC')) {
   		$is_top_level_cache = 1;
   	}
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services