Page MenuHomePhabricator

mw.widgets.TitleWidget should cache (client-side) the getInterwikiPrefixesPromise result
Closed, ResolvedPublic8 Story Points

Description

"Requires getting the API request to set the 'this is OK to cache' headers and the JS has to be updated to set the correct parameter thingy" according to @Legoktm.

Given this widget will eventually be used on every page read (in the search box), this would otherwise be hugely expensive for clients and the API server.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 16 2016, 12:40 AM
Anomie added a subscriber: Anomie.

Removing MediaWiki-API, since the API already supports this.

To get the API to output a public Cache-Control header, set the maxage and smaxage parameters in your query to the appropriate number of seconds and set uselang to something other than user (which is unfortunately the default, see T97096). For example, https://en.wikipedia.org/w/api.php?format=json&action=query&meta=siteinfo&siprop=interwikimap&maxage=300&smaxage=300&uselang=content.

Also, make sure your library uses a consistent parameter ordering when building the query string.

Change 327767 had a related patch set uploaded (by Legoktm):
TitleWidget: Cache siteinfo API response

https://gerrit.wikimedia.org/r/327767

Removing MediaWiki-API, since the API already supports this.
To get the API to output a public Cache-Control header, set the maxage and smaxage parameters in your query to the appropriate number of seconds and set uselang to something other than user (which is unfortunately the default, see T97096). For example, https://en.wikipedia.org/w/api.php?format=json&action=query&meta=siteinfo&siprop=interwikimap&maxage=300&smaxage=300&uselang=content.
Also, make sure your library uses a consistent parameter ordering when building the query string.

That's hugely helpful, thanks! :-)

Change 327767 merged by jenkins-bot:
TitleWidget: Cache siteinfo API response

https://gerrit.wikimedia.org/r/327767

Legoktm closed this task as Resolved.Dec 16 2016, 6:59 PM