attachments: Stop fetching attachments in / endpoint.

We only use this data in a rarely-used settings screen, and it can be
large after years of posting screenshots.

So optimize the performance of / by just loading these data when we
actually visit the page.

This saves about 300ms of runtime for loading the home view for my
user account on chat.zulip.org.
This commit is contained in:
Tim Abbott
2018-05-04 15:27:25 -07:00
parent 60185dddfd
commit 69c4645bd2
6 changed files with 27 additions and 14 deletions

View File

@@ -125,9 +125,6 @@ def fetch_initial_state_data(user_profile: UserProfile,
state['custom_profile_fields'] = [f.as_dict() for f in fields]
state['custom_profile_field_types'] = CustomProfileField.FIELD_TYPE_CHOICES
if want('attachments'):
state['attachments'] = user_attachments(user_profile)
if want('hotspots'):
state['hotspots'] = get_next_hotspots(user_profile)