From 733500556032a12c2e30730d850eb879f3a486d2 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 19 Oct 2015 09:42:06 -0700 Subject: [PATCH] More SquidUpdate cleanups * Remove $wgMaxSquidPurgeTitles; silently discarding URLs is the wrong way to limit things. The purge methods already batch, which HTCP pushing one at a time. Jobs already batch and have $wgJobBackoffThrottling. If code does purge 500 URLs at once with no limiting (flooding UDP), then it is already broken. * Make the HTCP method protected. * Rename $urlArr field. Change-Id: I17cced187fe7e93f5a5188022f12202a7746bdb7 --- RELEASE-NOTES-1.27 | 1 + includes/DefaultSettings.php | 5 ----- includes/deferred/SquidUpdate.php | 20 +++++--------------- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/RELEASE-NOTES-1.27 b/RELEASE-NOTES-1.27 index 835d38a316..2c64b2dc12 100644 --- a/RELEASE-NOTES-1.27 +++ b/RELEASE-NOTES-1.27 @@ -43,6 +43,7 @@ production. PasswordFactory themselves. ** A new constructor, User::newSystemUser(), has been added to simplify the creation of passwordless "system" users for logged actions. +* $wgMaxSquidPurgeTitles was removed. === New features in 1.27 === * $wgDataCenterId and $wgDataCenterRoles where added, which will serve as diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index c21301f1b9..7b196cb3d8 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2619,11 +2619,6 @@ $wgSquidServers = array(); */ $wgSquidServersNoPurge = array(); -/** - * Maximum number of titles to purge in any one client operation - */ -$wgMaxSquidPurgeTitles = 400; - /** * Whether to use a Host header in purge requests sent to the proxy servers * configured in $wgSquidServers. Set this to false to support Squid diff --git a/includes/deferred/SquidUpdate.php b/includes/deferred/SquidUpdate.php index 8d535b19c4..5f1552d637 100644 --- a/includes/deferred/SquidUpdate.php +++ b/includes/deferred/SquidUpdate.php @@ -26,25 +26,15 @@ * @ingroup Cache */ class SquidUpdate implements DeferrableUpdate { - /** - * Collection of URLs to purge. - * @var array - */ - protected $urlArr; + /** @var string[] Collection of URLs to purge */ + protected $urls = array(); /** * @param array $urlArr Collection of URLs to purge */ public function __construct( array $urlArr ) { - global $wgMaxSquidPurgeTitles; - // Remove duplicate URLs from list - $urlArr = array_unique( $urlArr ); - if ( count( $urlArr ) > $wgMaxSquidPurgeTitles ) { - // Truncate to desired maximum URL count - $urlArr = array_slice( $urlArr, 0, $wgMaxSquidPurgeTitles ); - } - $this->urlArr = $urlArr; + $this->urls = array_unique( $urlArr ); } /** @@ -77,7 +67,7 @@ class SquidUpdate implements DeferrableUpdate { * Purges the list of URLs passed to the constructor. */ public function doUpdate() { - self::purge( $this->urlArr ); + self::purge( $this->urls ); } /** @@ -136,7 +126,7 @@ class SquidUpdate implements DeferrableUpdate { * @throws MWException * @param array $urlArr Collection of URLs to purge */ - public static function HTCPPurge( $urlArr ) { + protected static function HTCPPurge( $urlArr ) { global $wgHTCPRouting, $wgHTCPMulticastTTL; // HTCP CLR operation -- 2.20.1