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
1=== modified file 'lib/lp/registry/browser/productseries.py'
2--- lib/lp/registry/browser/productseries.py 2009-10-22 09:24:53 +0000
3+++ lib/lp/registry/browser/productseries.py 2009-10-23 16:28:12 +0000
4@@ -310,7 +310,7 @@
5
6 @property
7 def is_obsolete(self):
8- """Return True if the series is OBSOLETE"
9+ """Return True if the series is OBSOLETE.
10
11 Obsolete series do not need to display as much information as other
12 series. Accessing private bugs is an expensive operation and showing
13@@ -359,7 +359,7 @@
14 label = page_title
15
16 def __init__(self, context, request):
17- """Set the staic packaging information for this series."""
18+ """Set the static packaging information for this series."""
19 super(ProductSeriesUbuntuPackagingView, self).__init__(
20 context, request)
21 ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
22
23=== modified file 'lib/lp/registry/model/distribution.py'
24--- lib/lp/registry/model/distribution.py 2009-10-16 15:00:55 +0000
25+++ lib/lp/registry/model/distribution.py 2009-10-23 16:28:12 +0000
26@@ -10,8 +10,7 @@
27 from zope.interface import alsoProvides, implements
28 from zope.component import getUtility
29
30-from sqlobject import (
31- BoolCol, ForeignKey, SQLRelatedJoin, StringCol, SQLObjectNotFound)
32+from sqlobject import BoolCol, ForeignKey, SQLObjectNotFound, StringCol
33 from sqlobject.sqlbuilder import SQLConstant
34 from storm.locals import Desc, In, Join, SQL
35 from storm.store import Store
36@@ -26,6 +25,7 @@
37 from canonical.launchpad.components.decoratedresultset import (
38 DecoratedResultSet)
39 from canonical.launchpad.components.storm_operators import FTQ, Match, RANK
40+from canonical.lazr.utils import safe_hasattr
41 from lp.registry.model.announcement import MakesAnnouncements
42 from lp.soyuz.model.archive import Archive
43 from lp.soyuz.model.binarypackagename import BinaryPackageName
44@@ -325,10 +325,7 @@
45 return (2, self.name)
46 return (3, self.name)
47
48- # XXX: 2008-01-29 kiko: This is used in a number of places and given it's
49- # already listified, why not spare the trouble of regenerating this as a
50- # cachedproperty? Answer: because it breaks tests.
51- @property
52+ @cachedproperty('_cached_serieses')
53 def serieses(self):
54 """See `IDistribution`."""
55 ret = DistroSeries.selectBy(distribution=self)
56@@ -1497,6 +1494,9 @@
57 if owner.inTeam(self.driver) and not owner.inTeam(self.owner):
58 # This driver is a release manager.
59 series.driver = owner
60+
61+ if safe_hasattr(self, '_cached_serieses'):
62+ del self._cached_serieses
63 return series
64
65 @property