Page MenuHomePhabricator

Add caching to MentorStatusManager
Closed, ResolvedPublic

Description

Not related to the task but getEffectiveMentorForUser() is called something like 10 times to display the homepage (mostly because it is invoked by canRender() which is used quite a bit). It should really have an in-process cache.

MentorStatusManager is fairly expensive (it checks for (b)locks), and called a lot (on every pageview, due to Help panel). Add an in-process cache to it, and possibly a WAN cache as well, to avoid submitting too many queries.

QA notes

This task should not cause any differences in Mentor dashboard's behavior. If the caching logic is broken, it can cause Regression about mentor's status change not applying properly (still being asked questions after setting their status to away and similar).

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 868154 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] MentorStatusManager: Return an accurate back at timestamp

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

Urbanecm_WMF triaged this task as Medium priority.
Urbanecm_WMF moved this task from New Tasks to In Progress on the GrowthExperiments-Mentorship board.

Change 876019 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] MentorStatusManager: Add in-process caching

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

Change 876019 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] MentorStatusManager: Add in-process caching

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