More SquidUpdate cleanups
authorAaron Schulz <aschulz@wikimedia.org>
Mon, 19 Oct 2015 16:42:06 +0000 (09:42 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 19 Oct 2015 16:50:14 +0000 (16:50 +0000)
* 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
includes/DefaultSettings.php
includes/deferred/SquidUpdate.php

index 835d38a..2c64b2d 100644 (file)
@@ -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
index c21301f..7b196cb 100644 (file)
@@ -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
index 8d535b1..5f1552d 100644 (file)
  * @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