launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02681
[Merge] lp:~lifeless/launchpad/bug-721056 into lp:launchpad
Robert Collins has proposed merging lp:~lifeless/launchpad/bug-721056 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#721056 Bugtask:+index loads all messages to determine if the description was edited
https://bugs.launchpad.net/bugs/721056
For more details, see:
https://code.launchpad.net/~lifeless/launchpad/bug-721056/+merge/50266
Expose Bug._indexed_messages and use it to generate a much cheaper query for determining if the bugs description was changed. This should drop about 6 seconds off of the non-all-comments case for bug 1.
--
https://code.launchpad.net/~lifeless/launchpad/bug-721056/+merge/50266
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~lifeless/launchpad/bug-721056 into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2011-02-16 02:55:17 +0000
+++ lib/lp/bugs/browser/bugtask.py 2011-02-18 03:01:58 +0000
@@ -957,7 +957,8 @@
def wasDescriptionModified(self):
"""Return a boolean indicating whether the description was modified"""
- return (self.context.bug.indexed_messages[0].text_contents !=
+ return (self.context.bug._indexed_messages(
+ include_content=True, include_parents=False)[0].text_contents !=
self.context.bug.description)
@cachedproperty
=== modified file 'lib/lp/bugs/configure.zcml'
--- lib/lp/bugs/configure.zcml 2011-02-17 01:03:34 +0000
+++ lib/lp/bugs/configure.zcml 2011-02-18 03:01:58 +0000
@@ -742,6 +742,7 @@
getSubscriptionForPerson
getSubscriptionInfo
indexed_messages
+ _indexed_messages
getAlsoNotifiedSubscribers
getBugWatch
canBeNominatedFor
=== modified file 'lib/lp/bugs/interfaces/bug.py'
--- lib/lp/bugs/interfaces/bug.py 2011-02-17 01:03:34 +0000
+++ lib/lp/bugs/interfaces/bug.py 2011-02-18 03:01:58 +0000
@@ -411,6 +411,16 @@
value_type=Reference(schema=IMessage)),
exported_as='messages')
+ def _indexed_messages(include_content=False, include_parents=False):
+ """Low level query for getting bug messages.
+
+ :param include_content: If True retrieve the content for the messages
+ too.
+ :param include_parents: If True retrieve the object for parent
+ messages too. If False the parent attribute will be *forced* to
+ None to prevent lazy evaluation triggering database lookups.
+ """
+
followup_subject = Attribute("The likely subject of the next message.")
has_patches = Attribute("Does this bug have any patches?")