~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/browser/bugtask.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-08-29 23:09:37 UTC
  • mfrom: (13814.1.1 bug724025)
  • Revision ID: launchpad@pqm.canonical.com-20110829230937-ugrcoxhl7mfn5zov
[incr] [r=lifeless][bug=724025] Reduce queries when you have several
        branches for a bug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
247
247
from lp.bugs.interfaces.bugwatch import BugWatchActivityStatus
248
248
from lp.bugs.interfaces.cve import ICveSet
249
249
from lp.bugs.interfaces.malone import IMaloneApplication
 
250
from lp.code.interfaces.branchcollection import IAllBranches
250
251
from lp.registry.interfaces.distribution import (
251
252
    IDistribution,
252
253
    IDistributionSet,
882
883
    @cachedproperty
883
884
    def linked_branches(self):
884
885
        """Filter out the bug_branch links to non-visible private branches."""
885
 
        linked_branches = []
886
 
        for linked_branch in self.context.bug.linked_branches:
887
 
            if check_permission('launchpad.View', linked_branch.branch):
888
 
                linked_branches.append(linked_branch)
 
886
        linked_branches = list(
 
887
            self.context.bug.getVisibleLinkedBranches(
 
888
                self.user, eager_load=True))
 
889
        # This is an optimization for when we look at the merge proposals.
 
890
        # Note that, like all of these sorts of Storm cache optimizations, it
 
891
        # only helps if [launchpad] storm_cache_size in launchpad-lazr.conf is
 
892
        # pretty big--and as of this writing, it isn't for developer
 
893
        # instances.
 
894
        list(getUtility(IAllBranches).getMergeProposals(
 
895
            for_branches=[link.branch for link in linked_branches],
 
896
            eager_load=True))
889
897
        return linked_branches
890
898
 
891
899
    @property