[Rt-commit] [rtir] 02/12: Cleanly wrap CleanupRequest to flush our caches

Kevin Falcone falcone at bestpractical.com
Mon Apr 14 13:16:44 EDT 2014


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

falcone pushed a commit to branch 3.2/unwrap-hook-lexwrap
in repository rtir.

commit d65cdf526190fa89af2c02cb55fdaa8e618c910a
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Mar 26 13:51:37 2014 -0400

    Cleanly wrap CleanupRequest to flush our caches
    
    Old code had us purge caches before core caches, so we'll maintain that
    ordering.
---
 lib/RT/IR.pm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 7936241..7a03f36 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -631,14 +631,18 @@ sub DefaultConstituency {
 use Hook::LexWrap;
 
 if ( RT::IR->HasConstituency ) {
-    # ACL checks for multiple constituencies
 
+    # lots of wrapping going on
+    no warnings 'redefine';
+
+    # flush constituency caches on each request
     require RT::Interface::Web::Handler;
-    # flush constituency cache on each request
-    wrap 'RT::Interface::Web::Handler::CleanupRequest', pre => sub {
+    my $orig_CleanupRequest = RT::Interface::Web::Handler->can('CleanupRequest');
+    *RT::Interface::Web::Handler::CleanupRequest = sub {
         %RT::IR::ConstituencyCache = ();
         %RT::IR::HasNoQueueCache = ();
         RT::IR::_FlushQueueHasRightCache();
+        $orig_CleanupRequest->();
     };
 
     require RT::Record;

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


More information about the rt-commit mailing list