Make LocalSite filtering in HostingServiceAccountManager conditional.

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

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.

Summary ID
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
Description From Last Updated

'djblets.testing.decorators.add_fixtures' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

local variable 'account2' is assigned to but never used Column: 9 Error code: F841

reviewbotreviewbot

local variable 'account3' is assigned to but never used Column: 9 Error code: F841

reviewbotreviewbot

local variable 'account4' is assigned to but never used Column: 9 Error code: F841

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-5.0.x (30bc95d)
Loading...