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

Change subject: Wrap job execution around profiling calls.
......................................................................


Wrap job execution around profiling calls.

Change-Id: Idf184b7c2f7003032d3a28830ee9c4a1eaeaa98b
---
M includes/Wiki.php
M includes/job/jobs/RefreshLinksJob.php
M maintenance/runJobs.php
3 files changed, 5 insertions(+), 10 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Wiki.php b/includes/Wiki.php
index f8f699c..b9a7aac 100644
--- a/includes/Wiki.php
+++ b/includes/Wiki.php
@@ -621,11 +621,13 @@
                        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 ) {
+                               if ( $success === false ) {
                                        $output .= "Error: " . 
$job->getLastError() . ", Time: $t ms\n";
                                } else {
                                        $output .= "Success, Time: $t ms\n";
diff --git a/includes/job/jobs/RefreshLinksJob.php 
b/includes/job/jobs/RefreshLinksJob.php
index 9dbe827..d096da6 100644
--- a/includes/job/jobs/RefreshLinksJob.php
+++ b/includes/job/jobs/RefreshLinksJob.php
@@ -37,14 +37,11 @@
         * @return boolean success
         */
        function run() {
-               wfProfileIn( __METHOD__ );
-
                $linkCache = LinkCache::singleton();
                $linkCache->clear();
 
                if ( is_null( $this->title ) ) {
                        $this->error = "refreshLinks: Invalid title";
-                       wfProfileOut( __METHOD__ );
                        return false;
                }
 
@@ -59,13 +56,11 @@
                if ( !$revision ) {
                        $this->error = 'refreshLinks: Article not found "' .
                                $this->title->getPrefixedDBkey() . '"';
-                       wfProfileOut( __METHOD__ );
                        return false; // XXX: what if it was just deleted?
                }
 
                self::runForTitleInternal( $this->title, $revision, __METHOD__ 
);
 
-               wfProfileOut( __METHOD__ );
                return true;
        }
 
@@ -123,14 +118,11 @@
        function run() {
                global $wgUpdateRowsPerJob;
 
-               wfProfileIn( __METHOD__ );
-
                $linkCache = LinkCache::singleton();
                $linkCache->clear();
 
                if ( is_null( $this->title ) ) {
                        $this->error = "refreshLinks2: Invalid title";
-                       wfProfileOut( __METHOD__ );
                        return false;
                }
 
@@ -181,7 +173,6 @@
                        JobQueueGroup::singleton()->push( $jobs );
                }
 
-               wfProfileOut( __METHOD__ );
                return true;
        }
 
diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php
index ef80df5..1f48ffe 100644
--- a/maintenance/runJobs.php
+++ b/maintenance/runJobs.php
@@ -95,6 +95,7 @@
 
                                // Run the job...
                                $t = microtime( true );
+                               wfProfileIn( __METHOD__ . '-' . get_class( $job 
) );
                                try {
                                        $status = $job->run();
                                        $error = $job->getLastError();
@@ -102,6 +103,7 @@
                                        $status = false;
                                        $error = get_class( $e ) . ': ' . 
$e->getMessage();
                                }
+                               wfProfileOut( __METHOD__ . '-' . get_class( 
$job ) );
                                $timeMs = intval( ( microtime( true ) - $t ) * 
1000 );
 
                                // Mark the job as done on success or when the 
job cannot be retried

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idf184b7c2f7003032d3a28830ee9c4a1eaeaa98b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to