[Rt-commit] [rtir] 01/01: Remove more Constituency loads

Kevin Falcone falcone at bestpractical.com
Thu Apr 24 12:53:17 EDT 2014


This is an automated email from the git hooks/post-receive script.

falcone pushed a commit to branch 3.2/fewer-constituency-loads
in repository rtir.

commit 0a86dcb73b1084630d70feee2c1ac29f09442a36
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Apr 23 15:48:18 2014 -0400

    Remove more Constituency loads
    
    acaec6f4 removed a ton of failed loads for Constituency that filled the
    logs with "Couldn't load custom field by 'Constituency' identifier ".
    
    Employ similar protections for Queue object overrides.
    
    We need to be careful of any other code which uses GetQueueAttribute
    since in the default case it just calls _Value which may not be right.
---
 lib/RT/IR.pm | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 3db2a80..717106d 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -824,23 +824,25 @@ if ( RT::IR->HasConstituency ) {
     sub GetQueueAttribute {
         my $queue = shift;
         my $attr  = shift;
-        if ( ( my $id = $queue->{'_for_ticket'} ) ) {
-            my $const = $RT::IR::ConstituencyCache{$id};
-            if (!$const || $const eq '_none' ) {
-                my $ticket = RT::Ticket->new(RT->SystemUser);
-                $ticket->Load($id);
-                $const = $RT::IR::ConstituencyCache{$ticket->id}
-                    = $ticket->FirstCustomFieldValue('Constituency') || '_none';
-            }
-            if ($const ne '_none' && !$RT::IR::HasNoQueueCache{$const} ) {
-                my $new_queue = RT::Queue->new(RT->SystemUser);
-                $new_queue->LoadByCols( Name => $queue->Name . " - " . $const );
-                if ( $new_queue->id ) {
-                    my $val = $new_queue->_Value($attr) || $queue->_Value($attr);
-                    RT->Logger->debug("Overriden $attr is $val for ticket #$id according to constituency $const");
-                    return $val;
-                } else {
-                    $RT::IR::HasNoQueueCache{$const} = 1;
+        if ( RT::IR->OurQueue($queue) ) {
+            if ( ( my $id = $queue->{'_for_ticket'} ) ) {
+                my $const = $RT::IR::ConstituencyCache{$id};
+                if (!$const || $const eq '_none' ) {
+                    my $ticket = RT::Ticket->new(RT->SystemUser);
+                    $ticket->Load($id);
+                    $const = $RT::IR::ConstituencyCache{$ticket->id}
+                        = $ticket->FirstCustomFieldValue('Constituency') || '_none';
+                }
+                if ($const ne '_none' && !$RT::IR::HasNoQueueCache{$const} ) {
+                    my $new_queue = RT::Queue->new(RT->SystemUser);
+                    $new_queue->LoadByCols( Name => $queue->Name . " - " . $const );
+                    if ( $new_queue->id ) {
+                        my $val = $new_queue->_Value($attr) || $queue->_Value($attr);
+                        RT->Logger->debug("Overriden $attr is $val for ticket #$id according to constituency $const");
+                        return $val;
+                    } else {
+                        $RT::IR::HasNoQueueCache{$const} = 1;
+                    }
                 }
             }
         }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list