Merge lp:~sinzui/launchpad/conjoined-shortlist-0 into lp:launchpad

Proposed by Curtis Hovey
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 12530
Proposed branch: lp:~sinzui/launchpad/conjoined-shortlist-0
Merge into: lp:launchpad
Diff against target: 36 lines (+6/-3)
1 file modified
lib/lp/bugs/model/bugtask.py (+6/-3)
To merge this branch: bzr merge lp:~sinzui/launchpad/conjoined-shortlist-0
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+52096@code.launchpad.net

Description of the change

Increase the shortlist size for conjoined bugs.

    Launchpad bug: https://bugs.launchpad.net/bugs/226535
    Pre-implementation: lifeless
    Test: ./bin/test -vvc -t doc/bugtask.txt -t doc/bugwatch.txt

There are oopses involving about 100 pathological bugs that have more than
15 bug tasks. The conjoined code uses shortlist and we see
    UserWarning: shortlist() should not be used here.

We *do* want to use shortlist. Launchpad does not restrict bugtasks, nor
does it allow users to delete them--bugs *are* allowed to have more than
15. Lp does not have an issue working with these pathological cases, so
the shortlist can be increased.

--------------------------------------------------------------------

RULES

    * Set the shortlist size to 200 to accommodate the bugs.

QA

    * Visit https://bugs.launchpad.net/ubuntu/+source/pgadmin3/+bug/610975
    * Verify it displays.

LINT

    lib/lp/bugs/model/bugtask.py

IMPLEMENTATION

Extracted the shortlist calls to a private method. Updated the call to
pass longest_expected=200.
    lib/lp/bugs/model/bugtask.py

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Self approve.

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/bugs/model/bugtask.py'
2--- lib/lp/bugs/model/bugtask.py 2011-02-27 19:45:44 +0000
3+++ lib/lp/bugs/model/bugtask.py 2011-03-03 16:58:24 +0000
4@@ -759,10 +759,13 @@
5 conjoined_master = None
6 return conjoined_master
7
8+ def _get_shortlisted_bugtasks(self):
9+ return shortlist(self.bug.bugtasks, longest_expected=200)
10+
11 @property
12 def conjoined_master(self):
13 """See `IBugTask`."""
14- return self.getConjoinedMaster(shortlist(self.bug.bugtasks))
15+ return self.getConjoinedMaster(self._get_shortlisted_bugtasks())
16
17 @property
18 def conjoined_slave(self):
19@@ -773,7 +776,7 @@
20 if self.distroseries != distribution.currentseries:
21 # Only current series tasks are conjoined.
22 return None
23- for bugtask in shortlist(self.bug.bugtasks):
24+ for bugtask in self._get_shortlisted_bugtasks():
25 if (bugtask.distribution == distribution and
26 bugtask.sourcepackagename == self.sourcepackagename):
27 conjoined_slave = bugtask
28@@ -783,7 +786,7 @@
29 if self.productseries != product.development_focus:
30 # Only development focus tasks are conjoined.
31 return None
32- for bugtask in shortlist(self.bug.bugtasks):
33+ for bugtask in self._get_shortlisted_bugtasks():
34 if bugtask.product == product:
35 conjoined_slave = bugtask
36 break