Added $wgMaxBacklinksInvalidate to avoid massive html cache invalidation.
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 3 Jan 2013 00:56:00 +0000 (16:56 -0800)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 7 Jan 2013 01:50:47 +0000 (01:50 +0000)
Change-Id: I4fadded0e351883a907d307d64af31cdc6164240

includes/DefaultSettings.php
includes/cache/HTMLCacheUpdate.php

index 3fe76fc..aae3d5a 100644 (file)
@@ -6169,6 +6169,15 @@ $wgUpdateRowsPerJob = 500;
  */
 $wgUpdateRowsPerQuery = 100;
 
+/**
+ * Do not purge all the pages that use a page when it is edited
+ * if there are more than this many such pages. This is used to
+ * avoid invalidating a large portion of the squid/parser cache.
+ *
+ * This setting should factor in any squid/parser cache expiry settings.
+ */
+$wgMaxBacklinksInvalidate = false;
+
 /** @} */ # End job queue }
 
 /************************************************************************//**
index 791ae3e..8962cf3 100644 (file)
@@ -46,6 +46,8 @@ class HTMLCacheUpdate implements DeferrableUpdate {
        }
 
        public function doUpdate() {
+               global $wgMaxBacklinksInvalidate;
+
                wfProfileIn( __METHOD__ );
 
                $job = new HTMLCacheUpdateJob(
@@ -58,7 +60,9 @@ class HTMLCacheUpdate implements DeferrableUpdate {
                );
 
                $count = $this->mTitle->getBacklinkCache()->getNumLinks( $this->mTable, 200 );
-               if ( $count >= 200 ) { // many backlinks
+               if ( $wgMaxBacklinksInvalidate !== false && $count > $wgMaxBacklinksInvalidate ) {
+                       wfDebug( "Skipped HTML cache invalidation of {$this->mTitle->getPrefixedText}." );
+               } elseif ( $count >= 200 ) { // many backlinks
                        JobQueueGroup::singleton()->push( $job );
                        JobQueueGroup::singleton()->deduplicateRootJob( $job );
                } else { // few backlinks ($count might be off even if 0)