Page MenuHomePhabricator

MentorPageMentorManager::setMentorForUser should not use job queue for POSTs
Closed, ResolvedPublic

Description

Background

MentorPageMentorManager::setMentorForUser, the method we use for saving mentorchanges, always uses job queue to do it. That is because mentor assignment can happen on a GET request, and we cannot use the master connection on GET requests.

Partial solution

In many cases, mentor assignment actually happens in a POST request: via Special:ClaimMentee, via the API, on registration, etc. In those contexts, use of job queue is unnecessary and generally a bad idea. Let's use the context (already passed to MentorPageMentorManager, albeit casted as MessageLocalizer) to determine whether we're in a POST request, and save directly if we are, to limit impact of job queue issues.

Event Timeline

Change 666317 had a related patch set uploaded (by Urbanecm; owner: Urbanecm):
[mediawiki/extensions/GrowthExperiments@master] MentorManager: Do not use job queue for saving mentor when in POST request

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

Change 666317 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@master] MentorManager: Do not use job queue for saving mentor when in POST request

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

No direct way to QA, closing.