ChangeControl: Optimize creation by not re-reading changes
There are two different controlFor() methods that accept change id
and change. It seems that all callers have change instance available
so there is no need to re-read the changes from the database.
This fixes flaky query tests, see this thread for more details [1].
TEST PLAN:
To reproduce you need heavy load on your machine. For example start
LibreOffice's unit tests parallel to Gerrit's query tests:
$ libreoffice> make check
$ gerrit> buck test --no-results-cache //gerrit-server:query_tests
Repeat the last command multiple times. Without this change I observed
2-4 failures from 10 runs.
[1] https://groups.google.com/d/topic/repo-discuss/9wGKjTaVG7k
Change-Id: Ia95458e86b214b12186ca60ccad46d586e13a01c
4 files changed