Merge lp:~adeuring/launchpad/bug-746866 into lp:launchpad

Proposed by Abel Deuring
Status: Merged
Approved by: Aaron Bentley
Approved revision: no longer in the source branch.
Merged at revision: 12975
Proposed branch: lp:~adeuring/launchpad/bug-746866
Merge into: lp:launchpad
Diff against target: 29 lines (+5/-3)
1 file modified
lib/lp/bugs/model/bugbranch.py (+5/-3)
To merge this branch: bzr merge lp:~adeuring/launchpad/bug-746866
Reviewer Review Type Date Requested Status
Aaron Bentley (community) Approve
Review via email: mp+59954@code.launchpad.net

Commit message

[r=abentley][bug=746866] more efficient visibility query for BugBranchSet.getBranchesWithVisibleBugs()

Description of the change

This branch fixes bug 746866: Person:+branches timeout: sometimes-slow bug-branch link query.

Robert already analyzed the problem and suggested two fixes; I took the one from comment #4 in the bug report.

test: ./bin/test bugs -vvt test_bugbranch

no lint

To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) wrote :

This looks good. On line 30, I think the original spacing "where=subscribed" is correct.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/model/bugbranch.py'
2--- lib/lp/bugs/model/bugbranch.py 2011-02-10 14:42:11 +0000
3+++ lib/lp/bugs/model/bugbranch.py 2011-05-04 16:01:23 +0000
4@@ -18,6 +18,7 @@
5 )
6 from storm.expr import (
7 And,
8+ Exists,
9 Or,
10 Select,
11 )
12@@ -99,14 +100,15 @@
13 # ones they may be directly or indirectly subscribed to.
14 subscribed = And(
15 TeamParticipation.teamID == BugSubscription.person_id,
16- TeamParticipation.personID == user.id)
17+ TeamParticipation.personID == user.id,
18+ Bug.id == BugSubscription.bug_id)
19
20 visible = And(
21 Bug.id == BugBranch.bugID,
22 Or(
23 Bug.private == False,
24- Bug.id.is_in(Select(
25- columns=[BugSubscription.bug_id],
26+ Exists(Select(
27+ columns=[True],
28 tables=[BugSubscription, TeamParticipation],
29 where=subscribed))))
30