From: Brian Wolff Date: Sat, 29 Mar 2014 05:23:14 +0000 (-0300) Subject: Cache RecentChanges Atom feed in varnish for 15 seconds X-Git-Tag: 1.31.0-rc.0~16228^2 X-Git-Url: http://git.cyclocoop.org//%22javascript:ModifierStyle%28%27%22.%24id.%22%27%29/%22?a=commitdiff_plain;h=b954a12809f6e90aeb07bf9823af92d6b4a0b6c7;p=lhc%2Fweb%2Fwiklou.git Cache RecentChanges Atom feed in varnish for 15 seconds Prior to fc20c30d209, the feed was cached for 10 seconds. That change accidentally removed varnish caching. Re-add the caching, and upping to 15 seconds for good measure (15 second delay on the RSS feed shouldn't matter, people generally read those asynchronously anyhow. I was thinking of maybe even uping to 30 seconds). Users can still manually set an smaxage parameter via the url if they don't like the default cache time. This assumes nothing private (e.g. per user) is ever on the RSS feed. Reading through the ChangesList code this appears to be the case, as everyone is getting the feed from a shared memcache entry. Bug: 63249 Change-Id: I268d0a53067738ba96bee74c593358b0b28cc083 --- diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index ce3168ef9a..754c177002 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -249,6 +249,7 @@ production. * Added list=prefixsearch that works like action=opensearch but can be used as a generator. * (bug 24782) Various modules will now use unique continuation parameters. +* (bug 63249) Cache RecentChanges Atom feed in varnish for 15 seconds. === Languages updated in 1.23 === diff --git a/includes/api/ApiFeedRecentChanges.php b/includes/api/ApiFeedRecentChanges.php index 9062ad9241..a2641ee646 100644 --- a/includes/api/ApiFeedRecentChanges.php +++ b/includes/api/ApiFeedRecentChanges.php @@ -52,6 +52,12 @@ class ApiFeedRecentChanges extends ApiBase { $this->dieUsage( 'Invalid subscription feed type', 'feed-invalid' ); } + $this->getMain()->setCacheMode( 'public' ); + if ( !$this->getMain()->getParameter( 'smaxage' ) ) { + // bug 63249: This page gets hit a lot, cache at least 15 seconds. + $this->getMain()->setCacheMaxAge( 15 ); + } + $feedFormat = $this->params['feedformat']; $specialClass = $this->params['target'] !== null ? 'SpecialRecentchangeslinked'