expose_user_administered_teams_to_js called from views which are not the primary object on a page

Bug #788510 reported by Robert Collins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
High
Unassigned

Bug Description

MilestoneView.initialize calls expose_structural_subscription_data_to_js which calls expose_user_administered_teams_to_js which is expensive (can be up to 500ms or so on folk in many teams). This function is only intended to be used once per request because it seeds the js cache rules for 'what teams can the user subscribe to this object' - and the js cache doesn't specify which object, its assumed its the current page context. However MilestoneView is used when we render milestones in tables and other contexts with the result that we run this function many times - e.g. see bug 787765.

The function is being changed to short-circuit if it has been called already in one request, which for its intended use is fine, but is a bit ugly.

To remove this tech debt we need to either make it sane to call more than once per request (and only call for objects in that request that we're offering subscription UI's on in the one visible page).... or make the function assert if its called more than once (and fix all the fallout).

Tags: tech-debt
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.