Page MenuHomePhabricator

MentorPageMentorManager::setMentorForUser must invalidate MentorPageMentorManager's in-process cache
Closed, ResolvedPublic

Description

Background

Recently, MentorPageMentorManager::loadMentorUser started to use an in-process cache for the mentor, with indefinite expiry. However, this cache is never purged, while it should be invalidated when the MentorPageMentorManager::setMentorForUser method gets called, to ensure the proper mentor is loaded.

Impact

This is IMO doomed to cause troubles, if it is not a part of T275429: Homepage mentor is not stored persistently at Romanian Wikipedia already. Basically a request which first loads a mentor, then changes it, and then loads it again will have incorrect mentor loaded. Unsure whether that happens frequently in our codebase.

Event Timeline

Change 666319 had a related patch set uploaded (by Urbanecm; owner: Urbanecm):
[mediawiki/extensions/GrowthExperiments@master] Make MentorPageMentorManager to invalidate in-process mentor cache on changes

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

Change 666319 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@master] Make MentorPageMentorManager to invalidate in-process mentor cache on changes

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