Merge "Make DeferredUpdates enqueue updates that failed to run when possible"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 18 Mar 2019 23:02:58 +0000 (23:02 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 18 Mar 2019 23:02:58 +0000 (23:02 +0000)
includes/deferred/DeferredUpdates.php

index 67b5490..a14b25c 100644 (file)
@@ -280,6 +280,16 @@ class DeferredUpdates {
                        }
                        MWExceptionHandler::rollbackMasterChangesAndLog( $e );
 
+                       // Try to push the update as a job so it can run later perhaps
+                       if ( $mode !== 'enqueue' && $update instanceof EnqueueableDataUpdate ) {
+                               try {
+                                       $spec = $update->getAsJobSpecification();
+                                       JobQueueGroup::singleton( $spec['wiki'] )->push( $spec['job'] );
+                               } catch ( Exception $e ) {
+                                       MWExceptionHandler::rollbackMasterChangesAndLog( $e );
+                               }
+                       }
+
                        // VW-style hack to work around T190178, so we can make sure
                        // PageMetaDataUpdater doesn't throw exceptions.
                        if ( defined( 'MW_PHPUNIT_TEST' ) ) {