[Rt-commit] [rtir] 01/02: Restore cache removed in f2cc9a2

Kevin Falcone falcone at bestpractical.com
Thu Apr 24 17:59:05 EDT 2014


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

falcone pushed a commit to branch 3.2/caching
in repository rtir.

commit f8568e7e2804499ab9c4011646cd90141b9c14bc
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Apr 24 17:14:46 2014 -0400

    Restore cache removed in f2cc9a2
    
    The failing test referenced doesn't fail with this removed, so the
    failure was likely something else fixed during the work to make RTIR
    3.0.0 work.
    
    There are several places in RT::IR that assumed this cache existed and
    would call RT::IR->CustomFields in tight loops.  Since it loads global
    and queue-specific CFs in order to cache them, it makes looking up a
    single CF expensive.
    
    A private flush method was added in c3bd6477 but never actually used.
    Start using it, since without it the CFs are indeed cached between
    requests.  Luckily they're loaded by RT::SystemUser so there's no
    leakages, other than what you might expect to happen if you test
    visibility of CFs based on loading by the system user.
---
 lib/RT/IR.pm | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 3db2a80..78a7fc4 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -510,12 +510,7 @@ sub CustomFields {
         @_%2 ? (Field => @_) : @_
     );
 
-# TODO cache doesn't work with rt 3.9
-# t/customfields/defaults-on-linking.t will fail with cache on
-# maybe because it's called too early somewhere?
-# anyway, seems caching here is not a great idea
-# as it will obstruct cf updates later?
-#    unless ( keys %cache ) {
+    unless ( keys %cache ) {
         foreach my $qname ( @QUEUES ) {
             my $type = TicketType( Queue => $qname );
             $cache{$type} = [];
@@ -543,7 +538,7 @@ sub CustomFields {
         while ( my $cf = $cfs->Next ) {
             push @{ $cache{'Global'} }, $cf;
         }
-#    }
+    }
 
     my $type = TicketType( %arg );
 
@@ -566,7 +561,7 @@ sub CustomFields {
 }
 
 sub _FlushCustomFieldsCache {
-    %cache = ()
+    %cache = ();
 } }
 
 
@@ -640,6 +635,7 @@ if ( RT::IR->HasConstituency ) {
         %RT::IR::ConstituencyCache = ();
         %RT::IR::HasNoQueueCache = ();
         RT::Queue::_FlushQueueHasRightCache();
+        RT::IR::_FlushCustomFieldsCache();
         $orig_CleanupRequest->();
     };
 

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


More information about the rt-commit mailing list