Fix caching of ID-based Tool queries.
Review Request #11132 — Created Aug. 10, 2020 and submitted
When performing a
attempt to populate a cache of known
Toolobjects and then look up in
that cache. Those entries very rarely change, and are frequently
queried, so we want to limit the database hits.
There was a regression in this caching. While debugging performance
regressions from the Django 1.11 port, I noticed that we were getting
repeated queries for the same tools. This happened because
were being used in places (apparently from accessing
It's not clear yet whether this was an issue in Review Board 3.0 (and if
so, this will be backported).
This change fixes this up by making the caching logic a lot more
extensive. We now check for all sorts of variations of an ID lookup,
Unit tests were added to catch caching regressions.
Unit tests pass.
Manually verified that this fixed multiple queries for the same
in the profiling logs.
This blank line should go away.