Merge lp:~wgrant/launchpad/bug-736002 into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | William Grant | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 12808 | ||||
Proposed branch: | lp:~wgrant/launchpad/bug-736002 | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
430 lines (+113/-117) 11 files modified
lib/lp/bugs/browser/bugtarget.py (+28/-53) lib/lp/bugs/doc/bug-tags.txt (+20/-12) lib/lp/bugs/interfaces/bugtarget.py (+3/-1) lib/lp/bugs/model/bug.py (+43/-37) lib/lp/registry/model/distribution.py (+3/-2) lib/lp/registry/model/distributionsourcepackage.py (+2/-2) lib/lp/registry/model/distroseries.py (+3/-2) lib/lp/registry/model/product.py (+3/-2) lib/lp/registry/model/productseries.py (+3/-2) lib/lp/registry/model/projectgroup.py (+3/-2) lib/lp/registry/model/sourcepackage.py (+2/-2) |
||||
To merge this branch: | bzr merge lp:~wgrant/launchpad/bug-736002 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeroen T. Vermeulen (community) | code | Approve | |
Review via email: mp+57278@code.launchpad.net |
Commit message
[r=jtv][bug=736002] Speed up +bugtarget-
Description of the change
This branch fixes tags_cloud_data to to issue only two queries, hopefully minimising timeouts on +bugtarget-
It used to display the official tags and the top 10 unofficial tags. This proves to be fairly expensive, so it will now display the official tags and the top 10 tags, some of which may duplicate the official tag set.
I've changed it to query the context's official tags, then perform a single UNION query to get the top 10 and official tag counts. Both sides of the union are done together in a single pass, and I've also avoided a slow join over Bug, letting the query complete in <4s for Ubuntu on staging.
Looks good. On IRC you said that we don't expect anyone to have a problem with the functional change, or if they do, we can solve it in other ways later.
Another, very small thing, in lib/lp/ bugs/browser/ bugtask. py:
80 + tags = [] iteritems( ): _getSearchURL( tag), tag_dict)
81 + for tag, count in raw_tags.
82 + tag_dict = dict(
83 + tag=tag, count=count, url=self.
84 + factor=1 + (count / max_count))
85 + if tag in official_tags:
86 + tag_dict['factor'] += 0.5
87 + tags.append(
The "factor=1 + (count / maxcount)" is a bit misleading in terms of associativity. If you isolated the factor computation (including the "+= 0.5") in a function, this whole loop could be replaced with a list comprehension.
Jeroen