jenkins-bot has submitted this change and it was merged.

Change subject: Hide exceptions in MediaWiki::doJobs() as deferred updates do.
......................................................................


Hide exceptions in MediaWiki::doJobs() as deferred updates do.

Change-Id: Ia83029d4c06bf3f2be6ad0797e815464e44fd088
---
M includes/Wiki.php
1 file changed, 27 insertions(+), 20 deletions(-)

Approvals:
  Demon: Looks good to me, approved
  Hashar: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/Wiki.php b/includes/Wiki.php
index 3f7e19c..cb0f60a 100644
--- a/includes/Wiki.php
+++ b/includes/Wiki.php
@@ -624,27 +624,34 @@
                        wfShellExec( "$cmd &", $retVal );
                        wfProfileOut( __METHOD__ . '-exec' );
                } else {
-                       // Fallback to running the jobs here while the user 
waits
-                       $group = JobQueueGroup::singleton();
-                       do {
-                               $job = $group->pop( JobQueueGroup::USE_CACHE ); 
// job from any queue
-                               if ( $job ) {
-                                       $output = $job->toString() . "\n";
-                                       $t = - microtime( true );
-                                       wfProfileIn( __METHOD__ . '-' . 
get_class( $job ) );
-                                       $success = $job->run();
-                                       wfProfileOut( __METHOD__ . '-' . 
get_class( $job ) );
-                                       $group->ack( $job ); // done
-                                       $t += microtime( true );
-                                       $t = round( $t * 1000 );
-                                       if ( $success === false ) {
-                                               $output .= "Error: " . 
$job->getLastError() . ", Time: $t ms\n";
-                                       } else {
-                                               $output .= "Success, Time: $t 
ms\n";
+                       try {
+                               // Fallback to running the jobs here while the 
user waits
+                               $group = JobQueueGroup::singleton();
+                               do {
+                                       $job = $group->pop( 
JobQueueGroup::USE_CACHE ); // job from any queue
+                                       if ( $job ) {
+                                               $output = $job->toString() . 
"\n";
+                                               $t = - microtime( true );
+                                               wfProfileIn( __METHOD__ . '-' . 
get_class( $job ) );
+                                               $success = $job->run();
+                                               wfProfileOut( __METHOD__ . '-' 
. get_class( $job ) );
+                                               $group->ack( $job ); // done
+                                               $t += microtime( true );
+                                               $t = round( $t * 1000 );
+                                               if ( $success === false ) {
+                                                       $output .= "Error: " . 
$job->getLastError() . ", Time: $t ms\n";
+                                               } else {
+                                                       $output .= "Success, 
Time: $t ms\n";
+                                               }
+                                               wfDebugLog( 'jobqueue', $output 
);
                                        }
-                                       wfDebugLog( 'jobqueue', $output );
-                               }
-                       } while ( --$n && $job );
+                               } while ( --$n && $job );
+                       } catch ( MWException $e ) {
+                               // We don't want exceptions thrown during job 
execution to
+                               // be reported to the user since the output is 
already sent.
+                               // Instead we just log them.
+                               wfDebugLog( 'exception', $e->getLogMessage() );
+                       }
                }
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/63818
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia83029d4c06bf3f2be6ad0797e815464e44fd088
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Demon <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to