Merge lp://staging/~allenap/launchpad/stop-checkwatches-hammering-products-bug-506158-devel into lp://staging/launchpad

Proposed by Gavin Panella
Status: Merged
Approved by: Graham Binns
Approved revision: not available
Merged at revision: not available
Proposed branch: lp://staging/~allenap/launchpad/stop-checkwatches-hammering-products-bug-506158-devel
Merge into: lp://staging/launchpad
Diff against target: 112 lines (+28/-7)
2 files modified
lib/lp/bugs/doc/externalbugtracker.txt (+22/-6)
lib/lp/bugs/scripts/checkwatches.py (+6/-1)
To merge this branch: bzr merge lp://staging/~allenap/launchpad/stop-checkwatches-hammering-products-bug-506158-devel
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+17753@code.staging.launchpad.net

Commit message

Don't ask GNOME Bugzilla about product information when there are no products configured for syncing.

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :
Revision history for this message
Graham Binns (gmb) :
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/doc/externalbugtracker.txt'
2--- lib/lp/bugs/doc/externalbugtracker.txt 2010-01-14 09:52:54 +0000
3+++ lib/lp/bugs/doc/externalbugtracker.txt 2010-01-20 16:02:12 +0000
4@@ -79,7 +79,7 @@
5 ... bug_tracker_to_use = Bugzilla
6 ...
7 ... def getExternalBugTrackerToUse(self):
8- ... print "Getting external bugtracker to use..."
9+ ... print "Getting external bugtracker to use"
10 ... return self.bug_tracker_to_use(self.baseurl)
11
12 We'll create a helper method to allow us to avoid having to connect to a
13@@ -99,7 +99,7 @@
14
15 >>> trackers_and_watches = get_trackers_and_watches(
16 ... standard_bugzilla, [])
17- Getting external bugtracker to use...
18+ Getting external bugtracker to use
19
20 >>> len(trackers_and_watches)
21 1
22@@ -118,7 +118,7 @@
23
24 >>> trackers_and_watches = get_trackers_and_watches(
25 ... standard_bugzilla, bug_watches)
26- Getting external bugtracker to use...
27+ Getting external bugtracker to use
28
29 >>> len(trackers_and_watches)
30 1
31@@ -154,7 +154,7 @@
32
33 >>> trackers_and_watches = get_trackers_and_watches(
34 ... gnome_bugzilla, bug_watches)
35- Getting external bugtracker to use...
36+ Getting external bugtracker to use
37
38 >>> len(trackers_and_watches)
39 1
40@@ -182,6 +182,7 @@
41 ... }
42 ...
43 ... def getProductsForRemoteBugs(self, bug_ids):
44+ ... print "Getting products for remote bugs"
45 ... mappings = {}
46 ... for bug_id in bug_ids:
47 ... if int(bug_id) in self.remote_bug_products:
48@@ -228,7 +229,8 @@
49
50 >>> trackers_and_watches = get_trackers_and_watches(
51 ... gnome_bugzilla, bug_watches)
52- Getting external bugtracker to use...
53+ Getting external bugtracker to use
54+ Getting products for remote bugs
55
56 >>> len(trackers_and_watches)
57 2
58@@ -269,7 +271,8 @@
59
60 >>> trackers_and_watches = get_trackers_and_watches(
61 ... gnome_bugzilla, bug_watches)
62- Getting external bugtracker to use...
63+ Getting external bugtracker to use
64+ Getting products for remote bugs
65
66 >>> len(trackers_and_watches)
67 2
68@@ -298,6 +301,19 @@
69 ... print watch.remotebug
70 4
71
72+If there are no syncable GNOME products, only one batch is returned,
73+and the remote system is never asked about product information.
74+
75+ >>> bug_watch_updater = BugWatchUpdater(
76+ ... FakeTransaction(), syncable_gnome_products=[])
77+
78+ >>> trackers_and_watches = get_trackers_and_watches(
79+ ... gnome_bugzilla, bug_watches)
80+ Getting external bugtracker to use
81+
82+ >>> len(trackers_and_watches)
83+ 1
84+
85
86 === Checking the server DB time ===
87
88
89=== modified file 'lib/lp/bugs/scripts/checkwatches.py'
90--- lib/lp/bugs/scripts/checkwatches.py 2010-01-14 09:52:54 +0000
91+++ lib/lp/bugs/scripts/checkwatches.py 2010-01-20 16:02:12 +0000
92@@ -423,7 +423,8 @@
93 # We special-case the Gnome Bugzilla.
94 gnome_bugzilla = getUtility(ILaunchpadCelebrities).gnome_bugzilla
95 if (bug_tracker == gnome_bugzilla and
96- isinstance(remotesystem_to_use, BugzillaAPI)):
97+ isinstance(remotesystem_to_use, BugzillaAPI) and
98+ len(self._syncable_gnome_products) > 0):
99
100 syncable_watches = []
101 other_watches = []
102@@ -471,6 +472,10 @@
103 bug_tracker.getBugWatchesNeedingUpdate(23))
104
105 if bug_watches_to_update.count() > 0:
106+ # XXX: GavinPanella 2010-01-18 bug=509223 : Ask remote
107+ # tracker which remote bugs have been modified, and use
108+ # this to fill up a batch, rather than figuring out
109+ # batching later in _getRemoteIdsToCheck().
110 try:
111 trackers_and_watches = self._getExternalBugTrackersAndWatches(
112 bug_tracker, bug_watches_to_update)