From b4ca98b8e556cd984647f4ca692ef5d199a6f888 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 14 May 2013 18:52:33 -0700 Subject: [PATCH] [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 --- includes/job/JobQueueDB.php | 10 ++++++++++ 1 file changed, 10 insertions(+) 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', -- 2.20.1