Use 'flush' flag to end automatic transactions.
authordaniel <daniel.kinzler@wikimedia.de>
Tue, 16 Oct 2012 11:18:41 +0000 (13:18 +0200)
committerdaniel <daniel.kinzler@wikimedia.de>
Tue, 16 Oct 2012 11:18:41 +0000 (13:18 +0200)
Call commit with the flush flag in JobQueueDB::doPop, so no warning
is triggered if an automatic transaction is already in progress.

Change-Id: I74f7170671103b0b1ea8afe09e3b105b03dde7e6

includes/job/JobQueueDB.php

index 3d584ef..1dd1d44 100644 (file)
@@ -113,10 +113,7 @@ class JobQueueDB extends JobQueue {
                $uuid = wfRandomString( 32 ); // pop attempt
 
                $dbw = $this->getMasterDB();
-               if ( $dbw->trxLevel() ) {
-                       wfWarn( "Attempted to pop a job in a transaction; committing first." );
-                       $dbw->commit(); // push existing transaction
-               }
+               $dbw->commit( __METHOD__, 'flush' ); // flush existing transaction
 
                $job = false; // job popped off
                $autoTrx = $dbw->getFlag( DBO_TRX ); // automatic begin() enabled?