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 1

This is not the most recent revision of the diff. The latest diff is revision 2. See what's changed.

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.
414652ac5767a8f2b2a1dcbe2a62700e726a1d16 Christian Hammond
reviewboard/hostingsvcs/managers.py
reviewboard/hostingsvcs/tests/test_hosting_service_account_manager.py
Loading...