Page MenuHomePhabricator

Cache results of articleinfo API after so many requests for the same data
Closed, ResolvedPublic5 Estimated Story Points

Description

We normally do not want to cache the articleinfo endpoint because in general the same page is not loaded more than once, and it's quite fast as it is. If we did cache every request, we'd unnecessarily be consuming a lot of memory.

However some pages like Admin noticeboards, etc., receive a lot of traffic and could benefit from caching.

Additionally, we have a rate-limiter that rejects requests if a single user makes the same exact request over 5 times in the same minute. We should disable this for the articleinfo API entirely.

Event Timeline

kaldari set the point value for this task to 5.Sep 12 2017, 11:32 PM
DannyH moved this task from Needs Discussion to Up Next (June 3-21) on the Community-Tech board.
MusikAnimal moved this task from Ready to In Development on the Community-Tech-Sprint board.
MusikAnimal moved this task from General / other to Working on the XTools board.

PR: https://github.com/x-tools/xtools/pull/114

Instead of doing it the hard way of keeping track of how many times a specific endpoint is hit, I'm just testing if the query took more than 5 minutes, and if so, cache for 20 minutes. The 5 and 20-minute figures are arbitrary.

PR approved, merged and deployed