mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
fetch_initial_state: Avoid doing one db query per announcement stream.
In 'fetch_initial_state_data' we were doing one database query per announcement stream. This commit updates the logic to prefetch those streams using select_related hence avoiding the extra db queries. Fixes #28909.
This commit is contained in:
committed by
Tim Abbott
parent
3ac14632d8
commit
f48e87cd3c
@@ -1174,7 +1174,7 @@ class FetchQueriesTest(ZulipTestCase):
|
||||
realm = get_realm_with_settings(realm_id=user.realm_id)
|
||||
|
||||
with (
|
||||
self.assert_database_query_count(43),
|
||||
self.assert_database_query_count(41),
|
||||
mock.patch("zerver.lib.events.always_want") as want_mock,
|
||||
):
|
||||
fetch_initial_state_data(user, realm=realm)
|
||||
@@ -1190,7 +1190,7 @@ class FetchQueriesTest(ZulipTestCase):
|
||||
muted_users=1,
|
||||
onboarding_steps=1,
|
||||
presence=1,
|
||||
realm=3,
|
||||
realm=1,
|
||||
realm_bot=1,
|
||||
realm_domains=1,
|
||||
realm_embedded_bots=0,
|
||||
|
||||
Reference in New Issue
Block a user