Org tenancy - removing redundant DB call

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

Branch: refs/heads/master
Commit: ea125163ef4666e72edca442ff591c935cadf6fe
Parents: 40375e6
Author: nir-sopher <[email protected]>
Authored: Thu Jun 1 16:24:00 2017 +0300
Committer: Jeremy Mitchell <[email protected]>
Committed: Tue Jul 18 12:12:31 2017 -0600

----------------------------------------------------------------------
 traffic_ops/app/lib/API/Tenant.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ea125163/traffic_ops/app/lib/API/Tenant.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Tenant.pm 
b/traffic_ops/app/lib/API/Tenant.pm
index 71c8afc..265aad5 100644
--- a/traffic_ops/app/lib/API/Tenant.pm
+++ b/traffic_ops/app/lib/API/Tenant.pm
@@ -246,7 +246,7 @@ sub delete {
                return $self->not_found();
        }       
 
-       my $name = $self->db->resultset('Tenant')->search( { id => $id } 
)->get_column('name')->single();
+       my $name = $tenant->name;
        
        my $existing_child = $self->db->resultset('Tenant')->search( { 
parent_id => $id }, {order_by => 'me.name' } )->get_column('name')->first();
        if ($existing_child) {

Reply via email to