Merge lp:~allenap/launchpad/early-batching-limit-bug-509223 into lp:launchpad

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~allenap/launchpad/early-batching-limit-bug-509223
Merge into: lp:launchpad
Prerequisite: lp:~allenap/launchpad/early-batching-bug-509223
Diff against target: 31 lines (+8/-1)
2 files modified
lib/lp/bugs/scripts/checkwatches/updater.py (+5/-1)
lib/lp/bugs/scripts/tests/test_bugimport.py (+3/-0)
To merge this branch: bzr merge lp:~allenap/launchpad/early-batching-limit-bug-509223
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+23776@code.launchpad.net

Commit message

In checkwatches, limit the number of bug watches to consider at any time to 1000.

Description of the change

Artificially limit the number of bug watches to consider to 1000. This approach is a bit inelegant and ham-fisted, but it's an approach that has made checkwatches considerably more reliable in production (since being cherry-picked last week, gnome-bugs is basically up to date).

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

This merge proposal is my favorite of the day because it mentions ham and cherries.

The code looks good too.

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/scripts/checkwatches/updater.py'
2--- lib/lp/bugs/scripts/checkwatches/updater.py 2010-04-21 09:34:31 +0000
3+++ lib/lp/bugs/scripts/checkwatches/updater.py 2010-04-21 09:34:32 +0000
4@@ -422,8 +422,12 @@
5 def _updateBugTracker(self, bug_tracker, batch_size=None):
6 """Updates the given bug trackers's bug watches."""
7 with self.transaction:
8+ # Never work with more than 1000 bug watches at a
9+ # time. Especially after a release or an outage, a large
10+ # bug tracker could have have >10000 bug watches eligible
11+ # for update.
12 bug_watches_to_update = (
13- bug_tracker.watches_needing_update)
14+ bug_tracker.watches_needing_update.config(limit=1000))
15 bug_watches_need_updating = (
16 bug_watches_to_update.count() > 0)
17
18
19=== modified file 'lib/lp/bugs/scripts/tests/test_bugimport.py'
20--- lib/lp/bugs/scripts/tests/test_bugimport.py 2010-03-26 13:48:53 +0000
21+++ lib/lp/bugs/scripts/tests/test_bugimport.py 2010-04-21 09:34:32 +0000
22@@ -807,6 +807,9 @@
23 Returns a list with a `count` method.
24 """
25
26+ def config(self, limit):
27+ return self.__class__(self[:limit])
28+
29 def count(self):
30 """See `SelectResults`."""
31 return len(self)