X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdeferred%2FCdnCacheUpdate.php;h=66ce9a3ddf839f547255ab6e6c5c7cd64b8238d7;hb=249454d777242108dbb61fbb32aa11cde6d4ea5e;hp=6f961e8b71d7c50f67708c57913b718623fda7ea;hpb=962b690e92a258bd53100e976dc5575180696bf0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/deferred/CdnCacheUpdate.php b/includes/deferred/CdnCacheUpdate.php index 6f961e8b71..66ce9a3ddf 100644 --- a/includes/deferred/CdnCacheUpdate.php +++ b/includes/deferred/CdnCacheUpdate.php @@ -71,25 +71,22 @@ class CdnCacheUpdate implements DeferrableUpdate, MergeableUpdate { self::purge( $this->urls ); if ( $wgCdnReboundPurgeDelay > 0 ) { - JobQueueGroup::singleton()->lazyPush( new CdnPurgeJob( - Title::makeTitle( NS_SPECIAL, 'Badtitle/' . __CLASS__ ), - [ - 'urls' => $this->urls, - 'jobReleaseTimestamp' => time() + $wgCdnReboundPurgeDelay - ] - ) ); + JobQueueGroup::singleton()->lazyPush( new CdnPurgeJob( [ + 'urls' => $this->urls, + 'jobReleaseTimestamp' => time() + $wgCdnReboundPurgeDelay + ] ) ); } } /** - * Purges a list of CDN nodes defined in $wgSquidServers. + * Purges a list of CDN nodes defined in $wgCdnServers. * $urlArr should contain the full URLs to purge as values * (example: $urlArr[] = 'http://my.host/something') * * @param string[] $urlArr List of full URLs to purge */ public static function purge( array $urlArr ) { - global $wgSquidServers, $wgHTCPRouting; + global $wgCdnServers, $wgHTCPRouting; if ( !$urlArr ) { return; @@ -123,20 +120,20 @@ class CdnCacheUpdate implements DeferrableUpdate, MergeableUpdate { } // Do direct server purges if enabled (this does not scale very well) - if ( $wgSquidServers ) { - // Maximum number of parallel connections per squid - $maxSocketsPerSquid = 8; + if ( $wgCdnServers ) { + // Maximum number of parallel connections per CDN + $maxSocketsPerCdn = 8; // Number of requests to send per socket // 400 seems to be a good tradeoff, opening a socket takes a while $urlsPerSocket = 400; - $socketsPerSquid = ceil( count( $urlArr ) / $urlsPerSocket ); - if ( $socketsPerSquid > $maxSocketsPerSquid ) { - $socketsPerSquid = $maxSocketsPerSquid; + $socketsPerCdn = ceil( count( $urlArr ) / $urlsPerSocket ); + if ( $socketsPerCdn > $maxSocketsPerCdn ) { + $socketsPerCdn = $maxSocketsPerCdn; } $pool = new SquidPurgeClientPool; - $chunks = array_chunk( $urlArr, ceil( count( $urlArr ) / $socketsPerSquid ) ); - foreach ( $wgSquidServers as $server ) { + $chunks = array_chunk( $urlArr, ceil( count( $urlArr ) / $socketsPerCdn ) ); + foreach ( $wgCdnServers as $server ) { foreach ( $chunks as $chunk ) { $client = new SquidPurgeClient( $server ); foreach ( $chunk as $url ) {