Merge lp:~wallyworld/launchpad/projectgroup-timeout-1016156 into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Curtis Hovey | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 16144 | ||||
Proposed branch: | lp:~wallyworld/launchpad/projectgroup-timeout-1016156 | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
323 lines (+63/-35) 13 files modified
lib/lp/answers/browser/faqcollection.py (+1/-1) lib/lp/answers/browser/questiontarget.py (+1/-1) lib/lp/blueprints/doc/sprint.txt (+2/-0) lib/lp/blueprints/model/sprint.py (+14/-7) lib/lp/registry/browser/announcement.py (+9/-5) lib/lp/registry/browser/project.py (+1/-1) lib/lp/registry/browser/tests/pillar-views.txt (+2/-0) lib/lp/registry/browser/tests/projectgroup-views.txt (+6/-3) lib/lp/registry/doc/projectgroup.txt (+4/-2) lib/lp/registry/interfaces/projectgroup.py (+2/-7) lib/lp/registry/model/projectgroup.py (+19/-6) lib/lp/registry/templates/hasannouncements-portlet-latest.pt (+1/-1) lib/lp/translations/browser/project.py (+1/-1) |
||||
To merge this branch: | bzr merge lp:~wallyworld/launchpad/projectgroup-timeout-1016156 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Curtis Hovey (community) | code | Approve | |
Review via email: mp+129337@code.launchpad.net |
Commit message
Rework some entity properties to reduce query counts on the projectgroup index page and others.
Description of the change
== Implementation ==
The entity domain objects had (non-cached) properties which return result sets. So every time the property was referenced via a TAL expression, the query was re-run. I identified some core properties on various classes which are implicated on the project group index page, and also other pillar pages. These were converted to cached properties and listified. The result set creation was moved off to a separate getter if required.
As an example, for one project group index page, query count drops in half from the original number of about 70.
== Tests ==
A generic, internal optimisation, so rely on existing tests.
== Lint ==
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
The two changes to /lib/answers looks wrong. I see that we are converting the result set to a list, thus instantiating about 100 FAQs, but we only return 5. The change to questiontarget will instantiate several 1000 questions in the U1 and launchpad project groups. Surely this is slower than how the code it currently written. I think the current codes is issue a single query with a LIMIT and instantiating just the 5 FAQs or questions wanted. I think we want them converted to a list *after* the slice.