]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 822547: Make jobqueue.pl clear the request cache before sending each mail
authorByron Jones <bjones@mozilla.com>
Wed, 2 Jan 2013 16:31:37 +0000 (00:31 +0800)
committerByron Jones <bjones@mozilla.com>
Wed, 2 Jan 2013 16:31:37 +0000 (00:31 +0800)
r=dkl,a=LpSolit

Bugzilla.pm
Bugzilla/JobQueue.pm

index 111d567e6d4f485f6857b979c33478aaa0e10eab..baaf78ff73f23537665879cf775909a5c8e2b5e3 100644 (file)
@@ -618,6 +618,18 @@ sub request_cache {
     return $_request_cache;
 }
 
+sub clear_request_cache {
+    $_request_cache = {};
+    if ($ENV{MOD_PERL}) {
+        require Apache2::RequestUtil;
+        my $request = eval { Apache2::RequestUtil->request };
+        if ($request) {
+            my $pnotes = $request->pnotes;
+            delete @$pnotes{(keys %$pnotes)};
+        }
+    }
+}
+
 # This is a per-process cache.  Under mod_cgi it's identical to the
 # request_cache.  When using mod_perl, items in this cache live until the
 # worker process is terminated.
@@ -639,7 +651,7 @@ sub _cleanup {
         $dbh->bz_rollback_transaction() if $dbh->bz_in_transaction;
         $dbh->disconnect;
     }
-    undef $_request_cache;
+    clear_request_cache();
 
     # These are both set by CGI.pm but need to be undone so that
     # Apache can actually shut down its children if it needs to.
index 519313448ceb317bf0e77a017a6e87670d69c9ca..098ee7935925e9b7b8471e75914d134f3f5da38c 100644 (file)
@@ -93,6 +93,13 @@ sub insert {
     return $retval;
 }
 
+# Clear the request cache at the start of each run.
+sub work_once {
+    my $self = shift;
+    Bugzilla->clear_request_cache();
+    return $self->SUPER::work_once(@_);
+}
+
 1;
 
 __END__