Merge lp:~rvb/launchpad/branches-timeout-bug-827935-4 into lp:launchpad

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 14258
Proposed branch: lp:~rvb/launchpad/branches-timeout-bug-827935-4
Merge into: lp:launchpad
Prerequisite: lp:~rvb/launchpad/branches-timeout-bug-827935-3
Diff against target: 58 lines (+3/-16)
2 files modified
lib/lp/code/browser/branchlisting.py (+1/-8)
lib/lp/code/browser/tests/test_branchlisting.py (+2/-8)
To merge this branch: bzr merge lp:~rvb/launchpad/branches-timeout-bug-827935-4
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+81290@code.launchpad.net

Commit message

[incr] [r=adeuring][bug=827935] Always display the link to the "Active reviews" page on the branch listing page.

Description of the change

Another simplification to the simplified menu (which is protected by a FF) on https://code.launchpad.net/~me. Checking for the presence of active reviews (to choose whether or not we want to display a link) leads to this kind of request: http://paste.ubuntu.com/728236/ which takes 1s-2s on ~https://code.launchpad.net/~ubuntu-branches. You might think that the duplication of the block http://paste.ubuntu.com/728238/ is responsible for the bad performance but that's not the case; the problem is the enormous number of branches satisfying "Branch.transitively_private = FALSE" (300k on ~ubuntu-branches). The easy solution is to always display the link to the "Active reviews" page.

= Tests =
(Modified)
./bin/test -vvc test_branchlisting test_branch_list_activereviews_link

To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) wrote :

nice!

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/browser/branchlisting.py'
2--- lib/lp/code/browser/branchlisting.py 2011-11-04 15:39:33 +0000
3+++ lib/lp/code/browser/branchlisting.py 2011-11-04 15:39:39 +0000
4@@ -922,12 +922,6 @@
5 not self._getCountCollection().registeredBy(
6 self.person).is_empty())
7
8- @cachedproperty
9- def active_reviews_not_empty(self):
10- """Return the number of active reviews for self.person's branches."""
11- active_reviews = PersonActiveReviewsView(self.context, self.request)
12- return not active_reviews.getProposals().is_empty()
13-
14 def simplified_owned(self):
15 return Link(
16 canonical_url(self.context, rootsite='code'),
17@@ -950,8 +944,7 @@
18 def simplified_active_reviews(self):
19 return Link(
20 '+activereviews',
21- 'Active reviews',
22- enabled=self.active_reviews_not_empty)
23+ 'Active reviews')
24
25 @cachedproperty
26 def registered_branch_count(self):
27
28=== modified file 'lib/lp/code/browser/tests/test_branchlisting.py'
29--- lib/lp/code/browser/tests/test_branchlisting.py 2011-11-02 14:04:31 +0000
30+++ lib/lp/code/browser/tests/test_branchlisting.py 2011-11-04 15:39:39 +0000
31@@ -35,10 +35,7 @@
32 PersonProductSubscribedBranchesView,
33 SourcePackageBranchesView,
34 )
35-from lp.code.enums import (
36- BranchMergeProposalStatus,
37- BranchVisibilityRule,
38- )
39+from lp.code.enums import BranchVisibilityRule
40 from lp.code.model.branch import Branch
41 from lp.code.model.seriessourcepackagebranch import (
42 SeriesSourcePackageBranchSet,
43@@ -336,15 +333,12 @@
44 self.assertThat(page, subscribed_branches_matcher)
45
46 def test_branch_list_activereviews_link(self):
47+ # The link to the active reviews is always displayed.
48 active_review_matcher = soupmatchers.HTMLContains(
49 soupmatchers.Tag(
50 'Active reviews link', 'a', text='Active reviews',
51 attrs={'href': 'http://launchpad.dev/~barney'
52 '/+activereviews'}))
53- branch = self.factory.makeAnyBranch(owner=self.person)
54- self.factory.makeBranchMergeProposal(
55- target_branch=branch, registrant=self.person,
56- set_state=BranchMergeProposalStatus.NEEDS_REVIEW)
57 page = self.get_branch_list_page()
58 self.assertThat(page, active_review_matcher)
59