X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjobqueue%2FJobRunner.php;h=1350958b7859477eb1950f853d5f7fa7a2b94f8f;hb=fb7b637660638ad3329bc8a417ba12df632ff1f0;hp=0a0a7a2b79ac8c9a2a133e74887bb5170430d4b7;hpb=c7b960a2b52ea1ef24e8c319b7dc12400b3f6e07;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php index 0a0a7a2b79..1350958b78 100644 --- a/includes/jobqueue/JobRunner.php +++ b/includes/jobqueue/JobRunner.php @@ -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,13 +268,19 @@ class JobRunner implements LoggerAwareInterface { DeferredUpdates::doUpdates(); $this->commitMasterChanges( $job ); - $job->teardown(); } catch ( Exception $e ) { MWExceptionHandler::rollbackMasterChangesAndLog( $e ); $status = false; $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.