[Rt-commit] rt branch, 4.2/clear-ocfv-cache-on-exit, created. rt-4.2.14-34-g5c5ab66c6

? sunnavy sunnavy at bestpractical.com
Fri Mar 16 16:59:13 EDT 2018


The branch, 4.2/clear-ocfv-cache-on-exit has been created
        at  5c5ab66c6f380f5b9321912e95815996be531fe0 (commit)

- Log -----------------------------------------------------------------
commit 5c5ab66c6f380f5b9321912e95815996be531fe0
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Mar 16 03:36:02 2018 +0800

    Run ClearOCFVCache on exit.
    
    Entries in OCFVCache contain RT::CustomField objects, which have related
    RT::Ticket objects as ContextObject. To safely run
    RT::Ticket::ApplyTransactionBatch before global destruction, we need to
    remove RT::Ticket objects from global cache variable.

diff --git a/lib/RT/ObjectCustomFieldValues.pm b/lib/RT/ObjectCustomFieldValues.pm
index ac3df168f..9c70a5596 100644
--- a/lib/RT/ObjectCustomFieldValues.pm
+++ b/lib/RT/ObjectCustomFieldValues.pm
@@ -233,4 +233,13 @@ sub _DoCount {
 
 RT::Base->_ImportOverlays();
 
+END {
+
+    # Without this, there will be warnings generated like "Too late to safely
+    # run transaction-batch scrips...", you can test it by commentting it out
+    # and run some cf tests, e.g. perl -Ilib t/customfields/enter_one.t
+
+    ClearOCFVCache();
+}
+
 1;

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


More information about the rt-commit mailing list