Page MenuHomePhabricator

Performance: Prevent double query for the same User::idFromName() call.
Closed, ResolvedPublic

Description

If the same call to User::idFromName('Test') is called twice at the 1,000 entry limit on User::$idCacheByName it will result in two database queries being ran instead of one. This is because it adds the just looked up database query to the cache then does the check to truncate the cache.

Event Timeline

Alexia created this task.Jun 14 2019, 5:46 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 14 2019, 5:46 PM

Change 517108 had a related patch set uploaded (by Alexia; owner: Alexia):
[mediawiki/core@master] Truncate the idFromName cache before added the new look up to prevent a double query for the same User::idFromName() call.

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

Krinkle added a subscriber: Krinkle.

Thanks!

Change 517108 merged by jenkins-bot:
[mediawiki/core@master] user: Move idFromName cache truncation to before adding the new value

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

Krinkle closed this task as Resolved.Jun 14 2019, 6:18 PM
Krinkle claimed this task.
Krinkle removed a project: Patch-For-Review.