Merge lp:~deryck/launchpad/buglistings-preload-people-901122 into lp:launchpad
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Aaron Bentley on 2012-03-19 | ||||
| Approved revision: | no longer in the source branch. | ||||
| Merged at revision: | 14983 | ||||
| Proposed branch: | lp:~deryck/launchpad/buglistings-preload-people-901122 | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
284 lines (+83/-24) 7 files modified
lib/lp/bugs/browser/bugtask.py (+13/-5) lib/lp/bugs/browser/cvereport.py (+5/-3) lib/lp/bugs/browser/tests/test_bugtask.py (+26/-11) lib/lp/bugs/interfaces/bugtask.py (+6/-0) lib/lp/bugs/model/bugtask.py (+13/-0) lib/lp/registry/browser/milestone.py (+13/-2) lib/lp/registry/browser/tests/test_milestone.py (+7/-3) |
||||
| To merge this branch: | bzr merge lp:~deryck/launchpad/buglistings-preload-people-901122 | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Aaron Bentley (community) | 2012-03-12 | Approve on 2012-03-19 | |
|
Review via email:
|
|||
Commit Message
Add getBugTaskPeople method to IBugTaskSet to help with pre-loading bugtask-related people objects.
Description of the Change
This branch updates IBugTaskSet to provide a new method for getting people related to a set of bugtasks. This is useful in the new buglistings work so that we can show assignee and bug reporter without doing a lot more queries.
The bulk of the work is to add this helper method that gets all related people in one query. Then the call sites that deal with bugtask people are updated to make use of this. A few tests also had to be updated.
I did not do a pre-imp call, since this work mirrors the earlier pre-loading work I did. The same pattern is followed here as when I loaded tags, which followed the pattern used for loading bug badge properties.
I did do a bit more of a refactor to the test helper method make_bug_
I also chose to update the milestone browser code to follow the bugtask browser code, which means milestone pages now issue two more queries than before. However, this brings the two spots together and we could now add in data about assignee, bug reporter, or tags in milestone pages, without timing out the pages.
We are lint free here, too.
| Deryck Hodge (deryck) wrote : | # |
| Robert Collins (lifeless) wrote : | # |
I have a small question - it looks like this increases the queries for
milestone views *without* needing too (because the tests were passing
before). That smells like waste - we're doing work the user doesn't
need. Of course, I'm probably wrong, but interesting mind wants to
know :)

I update the branch to use IPersonSet. getPrecachedPer sonsFromIDs instead of a hand crafted query, per Robert's suggestion on IRC. This produces the same query count as my original new query.
FWIW, I mentioned to Robert on IRC that I thought I had seen more queries by listing out ownerID via
[bugtask. bug.ownerID for bugtask in bugtasks]
Turns out I was seeing more queries, but not from that. When you click around a bugtask search results list, we update the URL with query parameters. When you come to the page via these query strings, that view issues a couple more queries than without the query string. But these increased counts are consistent, no matter the data size -- 2 more than without the query string. Given that, I didn't dig too much into that issue, especially since I wanted to finish this off and get it landed.