Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/63819


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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/19/63819/1

diff --git a/includes/job/JobQueueDB.php b/includes/job/JobQueueDB.php
index 6f4f6d9..55872d1 100644
--- a/includes/job/JobQueueDB.php
+++ b/includes/job/JobQueueDB.php
@@ -270,6 +270,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
@@ -457,6 +462,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/63819
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie04c8baac218f5df770388e17096dcb4f2eb9cba
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

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

Reply via email to