mirror of https://github.com/zulip/zulip.git
e23af20079
This commit updates code to prefetch realm group settings like "can_create_public_channel_group" only when computing settings for "/register" response by refetching the realm object with select_related instead of fetching those settings in UserProfile query. This change is done because we do not need to prefetch these settings for every UserProfile object and for most of the cases where these settings are actually accessed, we can afford extra query like when checking permission to create streams. But we cannot afford one query extra for each setting when computing these settings for "/register" response, so we re-fetch the realm object with select_related leading to only one extra query. The query count changes in tests are - - Query count increases by 1 when calling fetch_initial_state_data for computing can_create_public_streams because Realm object from UserProfile does not have prefetched setting fields. - Query count increases by one in test_subs where streams are created which is as expected due to the setting not being prefetched. - Query count increases by 2 in tests in test_home.py where one query is to refetch the realm object and one for computing can_create_public_streams as mentioned above. |
||
---|---|---|
.. | ||
__init__.py | ||
alert_words.py | ||
bots.py | ||
clients.py | ||
constants.py | ||
custom_profile_fields.py | ||
drafts.py | ||
groups.py | ||
linkifiers.py | ||
lookups.py | ||
messages.py | ||
muted_users.py | ||
onboarding_steps.py | ||
prereg_users.py | ||
presence.py | ||
push_notifications.py | ||
realm_audit_logs.py | ||
realm_emoji.py | ||
realm_playgrounds.py | ||
realms.py | ||
recipients.py | ||
scheduled_jobs.py | ||
streams.py | ||
user_activity.py | ||
user_topics.py | ||
users.py |