From: Erik Bernhardson Date: Tue, 29 Aug 2017 16:30:14 +0000 (-0700) Subject: Batch request titles for cdn purge from db X-Git-Tag: 1.31.0-rc.0~2258^2 X-Git-Url: http://git.cyclocoop.org///%22%40url%40//%22?a=commitdiff_plain;h=3370b052fc8a9e5dfee646a1fcf8f38e9b4e6775;p=lhc%2Fweb%2Fwiklou.git Batch request titles for cdn purge from db Xenon shows a significant amount of time is spent individually fetching the content model for titles being purged. It's probably not a huge improvement but lets fetch them all in one go instead of lazily as needed. Change-Id: I71af6f13c84e740c1367617d7a51210501363b33 --- diff --git a/includes/cache/LinkBatch.php b/includes/cache/LinkBatch.php index 38cb6be566..30d105b212 100644 --- a/includes/cache/LinkBatch.php +++ b/includes/cache/LinkBatch.php @@ -43,7 +43,7 @@ class LinkBatch { protected $caller; /** - * @param LinkTarget[] $arr Initial items to be added to the batch + * @param Traversable|LinkTarget[] $arr Initial items to be added to the batch */ public function __construct( $arr = [] ) { foreach ( $arr as $item ) { diff --git a/includes/deferred/CdnCacheUpdate.php b/includes/deferred/CdnCacheUpdate.php index 470086ae9f..7fafc0ebca 100644 --- a/includes/deferred/CdnCacheUpdate.php +++ b/includes/deferred/CdnCacheUpdate.php @@ -49,11 +49,12 @@ class CdnCacheUpdate implements DeferrableUpdate, MergeableUpdate { /** * Create an update object from an array of Title objects, or a TitleArray object * - * @param Traversable|array $titles + * @param Traversable|Title[] $titles * @param string[] $urlArr * @return CdnCacheUpdate */ public static function newFromTitles( $titles, $urlArr = [] ) { + ( new LinkBatch( $titles ) )->execute(); /** @var Title $title */ foreach ( $titles as $title ) { $urlArr = array_merge( $urlArr, $title->getCdnUrls() );