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
=== modified file 'lib/lp/bugs/scripts/checkwatches/updater.py'
--- lib/lp/bugs/scripts/checkwatches/updater.py 2010-04-21 09:34:31 +0000
+++ lib/lp/bugs/scripts/checkwatches/updater.py 2010-04-21 09:34:32 +0000
@@ -422,8 +422,12 @@
422 def _updateBugTracker(self, bug_tracker, batch_size=None):422 def _updateBugTracker(self, bug_tracker, batch_size=None):
423 """Updates the given bug trackers's bug watches."""423 """Updates the given bug trackers's bug watches."""
424 with self.transaction:424 with self.transaction:
425 # Never work with more than 1000 bug watches at a
426 # time. Especially after a release or an outage, a large
427 # bug tracker could have have >10000 bug watches eligible
428 # for update.
425 bug_watches_to_update = (429 bug_watches_to_update = (
426 bug_tracker.watches_needing_update)430 bug_tracker.watches_needing_update.config(limit=1000))
427 bug_watches_need_updating = (431 bug_watches_need_updating = (
428 bug_watches_to_update.count() > 0)432 bug_watches_to_update.count() > 0)
429433
430434
=== modified file 'lib/lp/bugs/scripts/tests/test_bugimport.py'
--- lib/lp/bugs/scripts/tests/test_bugimport.py 2010-03-26 13:48:53 +0000
+++ lib/lp/bugs/scripts/tests/test_bugimport.py 2010-04-21 09:34:32 +0000
@@ -807,6 +807,9 @@
807 Returns a list with a `count` method.807 Returns a list with a `count` method.
808 """808 """
809809
810 def config(self, limit):
811 return self.__class__(self[:limit])
812
810 def count(self):813 def count(self):
811 """See `SelectResults`."""814 """See `SelectResults`."""
812 return len(self)815 return len(self)