Merge lp:~edwin-grubbs/launchpad/bug-458169-distroseries-timeout into lp:launchpad

Proposed by Edwin Grubbs
Status: Merged
Approved by: Edwin Grubbs
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~edwin-grubbs/launchpad/bug-458169-distroseries-timeout
Merge into: lp:launchpad
Diff against target: 65 lines
2 files modified
lib/lp/registry/browser/productseries.py (+2/-2)
lib/lp/registry/model/distribution.py (+6/-6)
To merge this branch: bzr merge lp:~edwin-grubbs/launchpad/bug-458169-distroseries-timeout
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+13851@code.launchpad.net

Commit message

Fixed timeouts on distroseries page and distro milestone page.

To post a comment you must log in.
Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :

Summary
-------

Fixed timeout on https://launchpad.net/ubuntu/karmic
and https://launchpad.net/ubuntu/+milestone/ubuntu-9.10/+index.

Implementation details
----------------------

Cached the Distribution.serieses and Distribution.currentseries
properties.

Tests
-----

./bin/test -vv -t 'distribution-soyuz.txt|productseries-views.txt'

Demo and Q/A
------------

* Open https://staging.launchpad.net/ubuntu/karmic
    * Should not timeout.
* Open https://staging.launchpad.net/ubuntu/+milestone/ubuntu-9.10/+index.
    * Should not timeout.

Revision history for this message
Brad Crittenden (bac) wrote :

Nice fix Edwin! This branch has to win the biggest bang for the buck award.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/registry/browser/productseries.py'
--- lib/lp/registry/browser/productseries.py 2009-10-22 09:24:53 +0000
+++ lib/lp/registry/browser/productseries.py 2009-10-23 16:28:12 +0000
@@ -310,7 +310,7 @@
310310
311 @property311 @property
312 def is_obsolete(self):312 def is_obsolete(self):
313 """Return True if the series is OBSOLETE"313 """Return True if the series is OBSOLETE.
314314
315 Obsolete series do not need to display as much information as other315 Obsolete series do not need to display as much information as other
316 series. Accessing private bugs is an expensive operation and showing316 series. Accessing private bugs is an expensive operation and showing
@@ -359,7 +359,7 @@
359 label = page_title359 label = page_title
360360
361 def __init__(self, context, request):361 def __init__(self, context, request):
362 """Set the staic packaging information for this series."""362 """Set the static packaging information for this series."""
363 super(ProductSeriesUbuntuPackagingView, self).__init__(363 super(ProductSeriesUbuntuPackagingView, self).__init__(
364 context, request)364 context, request)
365 ubuntu = getUtility(ILaunchpadCelebrities).ubuntu365 ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
366366
=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py 2009-10-16 15:00:55 +0000
+++ lib/lp/registry/model/distribution.py 2009-10-23 16:28:12 +0000
@@ -10,8 +10,7 @@
10from zope.interface import alsoProvides, implements10from zope.interface import alsoProvides, implements
11from zope.component import getUtility11from zope.component import getUtility
1212
13from sqlobject import (13from sqlobject import BoolCol, ForeignKey, SQLObjectNotFound, StringCol
14 BoolCol, ForeignKey, SQLRelatedJoin, StringCol, SQLObjectNotFound)
15from sqlobject.sqlbuilder import SQLConstant14from sqlobject.sqlbuilder import SQLConstant
16from storm.locals import Desc, In, Join, SQL15from storm.locals import Desc, In, Join, SQL
17from storm.store import Store16from storm.store import Store
@@ -26,6 +25,7 @@
26from canonical.launchpad.components.decoratedresultset import (25from canonical.launchpad.components.decoratedresultset import (
27 DecoratedResultSet)26 DecoratedResultSet)
28from canonical.launchpad.components.storm_operators import FTQ, Match, RANK27from canonical.launchpad.components.storm_operators import FTQ, Match, RANK
28from canonical.lazr.utils import safe_hasattr
29from lp.registry.model.announcement import MakesAnnouncements29from lp.registry.model.announcement import MakesAnnouncements
30from lp.soyuz.model.archive import Archive30from lp.soyuz.model.archive import Archive
31from lp.soyuz.model.binarypackagename import BinaryPackageName31from lp.soyuz.model.binarypackagename import BinaryPackageName
@@ -325,10 +325,7 @@
325 return (2, self.name)325 return (2, self.name)
326 return (3, self.name)326 return (3, self.name)
327327
328 # XXX: 2008-01-29 kiko: This is used in a number of places and given it's328 @cachedproperty('_cached_serieses')
329 # already listified, why not spare the trouble of regenerating this as a
330 # cachedproperty? Answer: because it breaks tests.
331 @property
332 def serieses(self):329 def serieses(self):
333 """See `IDistribution`."""330 """See `IDistribution`."""
334 ret = DistroSeries.selectBy(distribution=self)331 ret = DistroSeries.selectBy(distribution=self)
@@ -1497,6 +1494,9 @@
1497 if owner.inTeam(self.driver) and not owner.inTeam(self.owner):1494 if owner.inTeam(self.driver) and not owner.inTeam(self.owner):
1498 # This driver is a release manager.1495 # This driver is a release manager.
1499 series.driver = owner1496 series.driver = owner
1497
1498 if safe_hasattr(self, '_cached_serieses'):
1499 del self._cached_serieses
1500 return series1500 return series
15011501
1502 @property1502 @property