Make LocalSite filtering in HostingServiceAccountManager conditional.

Review Request #12398 — Created June 22, 2022 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

HostingServiceAccount.objects.accessible() no longer unconditionally
filters by LocalSite. Most deployments don't use Local Site
functionality, making the addition of this filter unnecessarily
expensive in the common case.

This change uses LocalSite.objects.has_local_sites() to determine
whether to include the filter.

It also removes the distinct() call, which is really not necessary for
this query.

Unit tests pass.

Diff Revision 2 (Latest)

orig
1
2

Commits

First Last Summary ID Author
Make LocalSite filtering in HostingServiceAccountManager conditional.
`HostingServiceAccount.objects.accessible()` no longer unconditionally filters by `LocalSite`. Most deployments don't use Local Site functionality, making the addition of this filter unnecessarily expensive in the common case. This change uses `LocalSite.objects.has_local_sites()` to determine whether to include the filter. It also removes the `distinct()` call, which is really not necessary for this query.
d650e557b6de1853966bca3ca0edc62147171150 Christian Hammond
reviewboard/hostingsvcs/managers.py
reviewboard/hostingsvcs/tests/test_hosting_service_account_manager.py
Loading...