You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2017/02/06 18:22:18 UTC

[1/2] incubator-trafficcontrol git commit: uses dbix prefetch to eliminate n+1 queries and removes example urls intented for a single deliveryservice

Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/master af23649b8 -> a401a25e9


uses dbix prefetch to eliminate n+1 queries and removes example urls intented for a single deliveryservice


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/5be91637
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/5be91637
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/5be91637

Branch: refs/heads/master
Commit: 5be9163775d38984c9929249506cf68d95b42356
Parents: af23649
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Mon Feb 6 10:37:25 2017 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Mon Feb 6 11:20:58 2017 -0700

----------------------------------------------------------------------
 .../traffic_ops_api/v12/deliveryservice.rst          |  3 ---
 traffic_ops/app/lib/API/Deliveryservice.pm           | 15 +++++----------
 2 files changed, 5 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5be91637/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
----------------------------------------------------------------------
diff --git a/docs/source/development/traffic_ops_api/v12/deliveryservice.rst b/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
index c1100dd..9e81b92 100644
--- a/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
+++ b/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
@@ -199,9 +199,6 @@ Delivery Service
             "dnsBypassTtl": "30",
             "dscp": "40",
             "edgeHeaderRewrite": null,
-            "exampleURLs": [
-                "http://edge.foo-ds.foo.bar.net"
-            ],
             "geoLimit": "0",
             "geoLimitCountries": null,
             "geoLimitRedirectURL": null,

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5be91637/traffic_ops/app/lib/API/Deliveryservice.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Deliveryservice.pm b/traffic_ops/app/lib/API/Deliveryservice.pm
index 0220cc0..88f7ab7 100644
--- a/traffic_ops/app/lib/API/Deliveryservice.pm
+++ b/traffic_ops/app/lib/API/Deliveryservice.pm
@@ -55,12 +55,8 @@ sub index {
 		$criteria{'me.id'} = { -in => \@ds_ids },;
 	}
 
-	my $rs_data = $self->db->resultset("Deliveryservice")->search( \%criteria, { order_by => 'me.' . $orderby } );
+	my $rs_data = $self->db->resultset("Deliveryservice")->search( \%criteria, { prefetch => [ 'cdn', 'profile', 'type' ], order_by => 'me.' . $orderby } );
 	while ( my $row = $rs_data->next ) {
-		my $cdn_domain   = $self->get_cdn_domain_by_ds_id( $row->id );
-		my $regexp_set   = &UI::DeliveryService::get_regexp_set( $self, $row->id );
-		my @example_urls = &UI::DeliveryService::get_example_urls( $self, $row->id, $regexp_set, $row, $cdn_domain, $row->protocol );
-
 		push(
 			@data, {
 				"active"                   => \$row->active,
@@ -76,7 +72,6 @@ sub index {
 				"dnsBypassTtl"             => $row->dns_bypass_ttl,
 				"dscp"                     => $row->dscp,
 				"edgeHeaderRewrite"        => $row->edge_header_rewrite,
-				"exampleURLs"              => \@example_urls,
 				"geoLimitRedirectURL"      => $row->geolimit_redirect_url,
 				"geoLimit"                 => $row->geo_limit,
 				"geoLimitCountries"        => $row->geo_limit_countries,
@@ -95,8 +90,8 @@ sub index {
 				"longDesc2"                => $row->long_desc_2,
 				"maxDnsAnswers"            => $row->max_dns_answers,
 				"midHeaderRewrite"         => $row->mid_header_rewrite,
-				"missLat"                  => 0.0 + $row->miss_lat,
-				"missLong"                 => 0.0 + $row->miss_long,
+				"missLat"                  => defined($row->miss_lat) ? 0.0 + $row->miss_lat : undef,
+				"missLat"                  => defined($row->miss_long) ? 0.0 + $row->miss_long : undef,
 				"multiSiteOrigin"          => \$row->multi_site_origin,
 				"multiSiteOriginAlgorithm" => $row->multi_site_origin_algorithm,
 				"orgServerFqdn"            => $row->org_server_fqdn,
@@ -192,8 +187,8 @@ sub show {
 				"matchList"                => \@matchlist,
 				"maxDnsAnswers"            => $row->max_dns_answers,
 				"midHeaderRewrite"         => $row->mid_header_rewrite,
-				"missLat"                  => 0.0 + $row->miss_lat,
-				"missLong"                 => 0.0 + $row->miss_long,
+				"missLat"                  => defined($row->miss_lat) ? 0.0 + $row->miss_lat : undef,
+				"missLat"                  => defined($row->miss_long) ? 0.0 + $row->miss_long : undef,
 				"multiSiteOrigin"          => \$row->multi_site_origin,
 				"multiSiteOriginAlgorithm" => $row->multi_site_origin_algorithm,
 				"orgServerFqdn"            => $row->org_server_fqdn,


[2/2] incubator-trafficcontrol git commit: This closes #252.

Posted by da...@apache.org.
This closes #252.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/a401a25e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/a401a25e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/a401a25e

Branch: refs/heads/master
Commit: a401a25e97675e33612a35902a24a4446d6bbaeb
Parents: 5be9163
Author: Dan Kirkwood <da...@gmail.com>
Authored: Mon Feb 6 11:22:11 2017 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Mon Feb 6 11:22:11 2017 -0700

----------------------------------------------------------------------

----------------------------------------------------------------------