From: Aaron Schulz Date: Wed, 15 May 2013 01:52:33 +0000 (-0700) Subject: [JobQueue] In addition to flushing any transaction, be sure to avoid new ones X-Git-Tag: 1.31.0-rc.0~19667^2 X-Git-Url: https://git.cyclocoop.org//%22?a=commitdiff_plain;h=b4ca98b8e556cd984647f4ca692ef5d199a6f888;p=lhc%2Fweb%2Fwiklou.git [JobQueue] In addition to flushing any transaction, be sure to avoid new ones * This probably only matters when jobs are not run via CLI scripts. Change-Id: Ie04c8baac218f5df770388e17096dcb4f2eb9cba --- diff --git a/includes/job/JobQueueDB.php b/includes/job/JobQueueDB.php index 6f4f6d98c1..55872d1245 100644 --- a/includes/job/JobQueueDB.php +++ b/includes/job/JobQueueDB.php @@ -270,6 +270,11 @@ class JobQueueDB extends JobQueue { list( $dbw, $scope ) = $this->getMasterDB(); $dbw->commit( __METHOD__, 'flush' ); // flush existing transaction + $autoTrx = $dbw->getFlag( DBO_TRX ); // get current setting + $dbw->clearFlag( DBO_TRX ); // make each query its own transaction + $scopedReset = new ScopedCallback( function() use ( $dbw, $autoTrx ) { + $dbw->setFlag( $autoTrx ? DBO_TRX : 0 ); // restore old setting + } ); $uuid = wfRandomString( 32 ); // pop attempt $job = false; // job popped off @@ -457,6 +462,11 @@ class JobQueueDB extends JobQueue { list( $dbw, $scope ) = $this->getMasterDB(); $dbw->commit( __METHOD__, 'flush' ); // flush existing transaction + $autoTrx = $dbw->getFlag( DBO_TRX ); // get current setting + $dbw->clearFlag( DBO_TRX ); // make each query its own transaction + $scopedReset = new ScopedCallback( function() use ( $dbw, $autoTrx ) { + $dbw->setFlag( $autoTrx ? DBO_TRX : 0 ); // restore old setting + } ); // Delete a row with a single DELETE without holding row locks over RTTs... $dbw->delete( 'job',