cache_helpers: Pass "realm" and "bot_owner" args to select_related.

This commit updates code to pass "realm" and "bot_owner" args to
select_related call in get_users. We pass "realm" and "bot_owner"
args to get_users because the caches which this function is used
to populate are used for get_user and get_user_profile_by_api_key
functions and they also select both these fields when querying for
UserProfile objects.
This commit is contained in:
Sahil Batra 2023-07-18 23:03:19 +05:30 committed by Tim Abbott
parent 3e09a21929
commit d0fe378075
1 changed files with 1 additions and 1 deletions

View File

@ -82,7 +82,7 @@ def get_active_realm_ids() -> ValuesQuerySet[RealmCount, int]:
def get_users() -> QuerySet[UserProfile]:
return UserProfile.objects.select_related().filter(
return UserProfile.objects.select_related("realm", "bot_owner").filter(
long_term_idle=False, realm__in=get_active_realm_ids()
)