GWicke has submitted this change and it was merged.

Change subject: Don't count all back links
......................................................................


Don't count all back links

Use the getNumLinks() LIMIT parameter to avoid counting all backlinks, which
can be an expensive operation with million of backlinks.

Change-Id: I50b3eff7b7c85256e85de230118f605971dd27b5
---
M RestbaseUpdateJob.php
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  GWicke: Verified; Looks good to me, approved



diff --git a/RestbaseUpdateJob.php b/RestbaseUpdateJob.php
index fc15115..e7a0a95 100644
--- a/RestbaseUpdateJob.php
+++ b/RestbaseUpdateJob.php
@@ -139,7 +139,12 @@
                                // a root partition job
                                if ( !isset( $this->params['range'] ) ) {
                                        // how many backlinks does this title 
have ?
-                                       $noLinks = 
$this->getTitle()->getBacklinkCache()->getNumLinks( $this->params['table'] );
+                                       $backlinkCache = 
$this->getTitle()->getBacklinkCache();
+                                       $noLinks = $backlinkCache->getNumLinks(
+                                               $this->params['table'],
+                                               // No need to count all
+                                               $wgRestbaseNoMinThrottle + 1
+                                       );
                                        if( $noLinks <= 
$wgRestbaseNoMinThrottle ) {
                                                // there is only a small number 
of jobs, so batch them all together
                                                $noJobs = $noLinks;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I50b3eff7b7c85256e85de230118f605971dd27b5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/RestBaseUpdateJobs
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: Mobrovac <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to