Cache RecentChanges Atom feed in varnish for 15 seconds
authorBrian Wolff <bawolff+wn@gmail.com>
Sat, 29 Mar 2014 05:23:14 +0000 (02:23 -0300)
committerReedy <reedy@wikimedia.org>
Mon, 14 Apr 2014 12:51:03 +0000 (13:51 +0100)
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

RELEASE-NOTES-1.23
includes/api/ApiFeedRecentChanges.php

index ce3168e..754c177 100644 (file)
@@ -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 ===
 
index 9062ad9..a2641ee 100644 (file)
@@ -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'