Commit 42c0ccb2 authored by Byron Jones's avatar Byron Jones

Bug 822547: Make jobqueue.pl clear the request cache before sending each mail

r=dkl,a=LpSolit
parent 3e911b8f
...@@ -641,6 +641,18 @@ sub request_cache { ...@@ -641,6 +641,18 @@ sub request_cache {
return $_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 # 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 # request_cache. When using mod_perl, items in this cache live until the
# worker process is terminated. # worker process is terminated.
...@@ -662,7 +674,7 @@ sub _cleanup { ...@@ -662,7 +674,7 @@ sub _cleanup {
$dbh->bz_rollback_transaction() if $dbh->bz_in_transaction; $dbh->bz_rollback_transaction() if $dbh->bz_in_transaction;
$dbh->disconnect; $dbh->disconnect;
} }
undef $_request_cache; clear_request_cache();
# These are both set by CGI.pm but need to be undone so that # 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. # Apache can actually shut down its children if it needs to.
......
...@@ -92,6 +92,13 @@ sub insert { ...@@ -92,6 +92,13 @@ sub insert {
return $retval; 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; 1;
__END__ __END__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment