Call $job->teardown() even if Job throws an exception.
[lhc/web/wiklou.git] / includes / jobqueue / JobRunner.php
index c542d97..1350958 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 ) {
@@ -272,6 +274,13 @@ class JobRunner implements LoggerAwareInterface {
                        $error = get_class( $e ) . ': ' . $e->getMessage();
                        MWExceptionHandler::logException( $e );
                }
+               // Always attempt to call teardown() even if Job throws exception.
+               try {
+                       $job->teardown();
+               } catch ( Exception $e ) {
+                       MWExceptionHandler::logException( $e );
+               }
+
                // Commit all outstanding connections that are in a transaction
                // to get a fresh repeatable read snapshot on every connection.
                // Note that jobs are still responsible for handling slave lag.
@@ -505,7 +514,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