← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~deryck/launchpad/adapt-badges-listing-item-901122 into lp:launchpad

 

Deryck Hodge has proposed merging lp:~deryck/launchpad/adapt-badges-listing-item-901122 into lp:launchpad with lp:~deryck/launchpad/preload-tags-for-buglistings-901122 as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #901122 in Launchpad itself: "New bug listings need to preload more attributes"
  https://bugs.launchpad.net/launchpad/+bug/901122

For more details, see:
https://code.launchpad.net/~deryck/launchpad/adapt-badges-listing-item-901122/+merge/95063

This is the second and final branch in getting the new bug data we added in custom buglistings loading with less queries.  This is a simple one line fix with a lot of power.  There's already a class to ensure we don't issue too many queries when getting badges.  See lp.app.browser.tales.BugTaskListingItemImageDisplayAPI.  But there is also it's super class lp.app.browser.tales.BugTaskImageDisplayAPI.  Since we were adapting based on bugtasks rather than self (which is the BugTaskListingItem) we were adapting to the super class and not BugTaskListingItemImageDisplayAPI, which is the class that helps us avoid the additional queries.

This fix is magical.  It brings us back down to pre-custom buglistings query levels +2.  But the +2 is consistent no matter the data size, and are attributed to cached queries to get tags and reporter name.

lifeless suggested I had a scaling test in the pre-req branch for this one, which I'll gladly add into this branch before considering the work done.
-- 
https://code.launchpad.net/~deryck/launchpad/adapt-badges-listing-item-901122/+merge/95063
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~deryck/launchpad/adapt-badges-listing-item-901122 into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py	2012-02-28 21:54:18 +0000
+++ lib/lp/bugs/browser/bugtask.py	2012-02-28 21:54:19 +0000
@@ -2200,7 +2200,7 @@
             date_last_updated = self.bug.date_last_updated
         last_updated_formatter = DateTimeFormatterAPI(date_last_updated)
         last_updated = last_updated_formatter.displaydate()
-        badges = getAdapter(self.bugtask, IPathAdapter, 'image').badges()
+        badges = getAdapter(self, IPathAdapter, 'image').badges()
         target_image = getAdapter(self.target, IPathAdapter, 'image')
         if self.bugtask.milestone is not None:
             milestone_name = self.bugtask.milestone.displayname


Follow ups