]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 702208: TheSchwartz should not open a new db connection for each email
authorByron Jones <bjones@mozilla.com>
Tue, 15 Nov 2011 08:13:10 +0000 (16:13 +0800)
committerByron Jones <bjones@mozilla.com>
Tue, 15 Nov 2011 08:13:10 +0000 (16:13 +0800)
r=mkanat, a=mkanat

Bugzilla/JobQueue.pm

index 2804b9179ad1784b25940ee5819704ca6c9bf8cf..7ea678345e839660377c0e3eac1eb17266efab9d 100644 (file)
@@ -35,6 +35,11 @@ use constant JOB_MAP => {
     send_mail => 'Bugzilla::Job::Mailer',
 };
 
+# Without a driver cache TheSchwartz opens a new database connection
+# for each email it sends.  This cached connection doesn't persist
+# across requests.
+use constant DRIVER_CACHE_TIME => 300; # 5 minutes
+
 sub job_map {
     if (!defined(Bugzilla->request_cache->{job_map})) {
         my $job_map = JOB_MAP;
@@ -62,6 +67,7 @@ sub new {
             pass   => $lc->{db_pass},
             prefix => 'ts_',
         }],
+        driver_cache_expiration => DRIVER_CACHE_TIME,
     );
 
     return $self;