bug.userCanView does too much work when not eager loaded
Bug #619039 reported by
Robert Collins
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
Low
|
William Grant |
Bug Description
bug.userCanView does this:
for subscription in self.subscriptions:
if user.inTeam(
return True
This is a problem:
some bugs have hundreds of subscriptions, and inTeam requires separate work as well.
Better to do an explicit direct query on bugsubscription joined with teamparticipation.
With a little glue this can update the users teamparticipation cache too, but this will drop 2 queries to 1, and reduce a many ms query to (probably) a 1-2ms query.
Of course, checking userCanView on bugs at all is bad for performance, but if we're going to do it, this will make it less painful.
Changed in malone: | |
status: | New → Triaged |
importance: | Undecided → High |
tags: | added: timeout |
summary: |
- bug.userCanView does too much work + bug.userCanView does too much work when not eager loaded |
Changed in launchpad: | |
importance: | High → Low |
Changed in launchpad: | |
assignee: | nobody → William Grant (wgrant) |
status: | Triaged → Fix Released |
To post a comment you must log in.
Also this code is duplicated verbatim in security.py!