jenkins-bot has submitted this change and it was merged.

Change subject: [JobQueue] In addition to flushing any transaction, be sure to 
avoid new ones
......................................................................


[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
(cherry picked from commit b4ca98b8e556cd984647f4ca692ef5d199a6f888)
---
M includes/job/JobQueueDB.php
1 file changed, 10 insertions(+), 0 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/job/JobQueueDB.php b/includes/job/JobQueueDB.php
index a7a459f..ff7f7ab 100644
--- a/includes/job/JobQueueDB.php
+++ b/includes/job/JobQueueDB.php
@@ -224,6 +224,11 @@
 
                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
@@ -490,6 +495,11 @@
 
                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',

-- 
To view, visit https://gerrit.wikimedia.org/r/63899
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie04c8baac218f5df770388e17096dcb4f2eb9cba
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_21
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Demon <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to