launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #04557
[Merge] lp:~gary/launchpad/bug724025 into lp:launchpad
Gary Poster has proposed merging lp:~gary/launchpad/bug724025 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #724025 in Launchpad itself: "BugTask:+index timeout due to high cpu time rendering many bug tasks in bug 230350"
https://bugs.launchpad.net/launchpad/+bug/724025
For more details, see:
https://code.launchpad.net/~gary/launchpad/bug724025/+merge/71076
This change, which is very small but took too long to discover, changes rendering a bugtask +index page with 150 bugtasks from taking 6+ seconds on my machine to 2.7 seconds. Good enough for now.
lint is happy.
Thank you!
--
https://code.launchpad.net/~gary/launchpad/bug724025/+merge/71076
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gary/launchpad/bug724025 into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2011-08-05 06:40:47 +0000
+++ lib/lp/bugs/browser/bugtask.py 2011-08-10 16:21:25 +0000
@@ -3408,6 +3408,15 @@
self.context.bug.duplicateof is None and
not self.is_converted_to_question)
+ def expandable(self):
+ """Can the task's details be expanded?
+
+ They can if there are not too many bugtasks, and if the user can see
+ the task details."""
+ # Looking at many_bugtasks is an important optimization. With 150+
+ # bugtasks, it can save three or four seconds of rendering time.
+ return not self.many_bugtasks and self.canSeeTaskDetails()
+
def getTaskRowCSSClass(self):
"""The appropriate CSS class for the row in the Affects table.
=== modified file 'lib/lp/bugs/templates/bugtask-tasks-and-nominations-table-row.pt'
--- lib/lp/bugs/templates/bugtask-tasks-and-nominations-table-row.pt 2011-07-20 12:13:41 +0000
+++ lib/lp/bugs/templates/bugtask-tasks-and-nominations-table-row.pt 2011-08-10 16:21:25 +0000
@@ -1,7 +1,7 @@
<tal:bugtask
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
- define="expandable view/canSeeTaskDetails;
+ define="expandable view/expandable;
indent_task view/shouldIndentTask;
is_conjoined_slave view/is_conjoined_slave;
tasklink view/taskLink;