Non-concurrent pop_type() since the $row === false case was being hit 99% of the...
authorTim Starling <tstarling@users.mediawiki.org>
Tue, 12 Jul 2011 08:08:58 +0000 (08:08 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Tue, 12 Jul 2011 08:08:58 +0000 (08:08 +0000)
includes/job/JobQueue.php

index 953d586..0d917ba 100644 (file)
@@ -56,15 +56,18 @@ abstract class Job {
 
                $dbw = wfGetDB( DB_MASTER );
 
+               $dbw->begin();
+
                $row = $dbw->selectRow(
                        'job',
                        '*',
                        array( 'job_cmd' => $type ),
                        __METHOD__,
-                       array( 'LIMIT' => 1 )
+                       array( 'LIMIT' => 1, 'FOR UPDATE' )
                );
 
                if ( $row === false ) {
+                       $dbw->commit();
                        wfProfileOut( __METHOD__ );
                        return false;
                }