Merge "TableDiffFormatter: Don't repeatedly call array_shift()"
[lhc/web/wiklou.git] / includes / jobqueue / JobRunner.php
index ed29e59..a2f55b9 100644 (file)
@@ -163,6 +163,8 @@ class JobRunner implements LoggerAwareInterface {
                                $popTime = time();
                                $jType = $job->getType();
 
+                               WebRequest::overrideRequestId( $job->getRequestId() );
+
                                // Back off of certain jobs for a while (for throttling and for errors)
                                $ttw = $this->getBackoffTimeToWait( $job );
                                if ( $ttw > 0 ) {
@@ -266,6 +268,7 @@ class JobRunner implements LoggerAwareInterface {
 
                        DeferredUpdates::doUpdates();
                        $this->commitMasterChanges( $job );
+                       $job->teardown();
                } catch ( Exception $e ) {
                        MWExceptionHandler::rollbackMasterChangesAndLog( $e );
                        $status = false;
@@ -289,9 +292,9 @@ class JobRunner implements LoggerAwareInterface {
                        $stats->timing( "jobqueue.pickup_delay.$jType", 1000 * $pickupDelay );
                }
                // Record root job age for jobs being run
-               $root = $job->getRootJobParams();
-               if ( $root['rootJobTimestamp'] ) {
-                       $age = max( 0, $popTime - wfTimestamp( TS_UNIX, $root['rootJobTimestamp'] ) );
+               $rootTimestamp = $job->getRootJobParams()['rootJobTimestamp'];
+               if ( $rootTimestamp ) {
+                       $age = max( 0, $popTime - wfTimestamp( TS_UNIX, $rootTimestamp ) );
                        $stats->timing( "jobqueue.pickup_root_age.$jType", 1000 * $age );
                }
                // Track the execution time for jobs
@@ -505,7 +508,7 @@ class JobRunner implements LoggerAwareInterface {
 
                $ms = intval( 1000 * $dbwSerial->pendingWriteQueryDuration() );
                $msg = $job->toString() . " COMMIT ENQUEUED [{$ms}ms of writes]";
-               $this->logger->warning( $msg );
+               $this->logger->info( $msg );
                $this->debugCallback( $msg );
 
                // Wait for an exclusive lock to commit