Make LocalSite filtering in HostingServiceAccountManager conditional.
Review Request #12398 — Created June 22, 2022 and submitted — Latest diff uploaded
HostingServiceAccount.objects.accessible()
no longer unconditionally
filters byLocalSite
. 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.