Merge lp:~stevenk/launchpad/getpublishedsources-too-eager into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 12802
Proposed branch: lp:~stevenk/launchpad/getpublishedsources-too-eager
Merge into: lp:launchpad
Diff against target: 55 lines (+9/-3)
3 files modified
lib/lp/soyuz/browser/archive.py (+2/-1)
lib/lp/soyuz/interfaces/archive.py (+3/-1)
lib/lp/soyuz/model/archive.py (+4/-1)
To merge this branch: bzr merge lp:~stevenk/launchpad/getpublishedsources-too-eager
Reviewer Review Type Date Requested Status
William Grant code* Approve
Robert Collins (community) Approve
Review via email: mp+57107@code.launchpad.net

Commit message

[no-qa] [r=lifeless,wgrant][bug=744849] Don't eager load by default in IArchive.getPublishedSources(), but instruct the API that it always should.

Description of the change

Add a eager_load parameter to IArchive.getPublishedSources() that disables eager loading for those callsites that do not require it. It defaults to True, so the API/page renders will always get it. So far the only callsite that disables it is the package cloner.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) :
review: Approve
Revision history for this message
William Grant (wgrant) wrote :

Thanks for the default inversion. s/if eager_load is False/if not eager_load/, otherwise fine.

review: Approve (code*)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/soyuz/browser/archive.py'
--- lib/lp/soyuz/browser/archive.py 2011-03-29 13:49:07 +0000
+++ lib/lp/soyuz/browser/archive.py 2011-04-12 01:45:06 +0000
@@ -824,7 +824,8 @@
824 return self.context.getPublishedSources(824 return self.context.getPublishedSources(
825 name=self.specified_name_filter,825 name=self.specified_name_filter,
826 status=self.getSelectedFilterValue('status_filter'),826 status=self.getSelectedFilterValue('status_filter'),
827 distroseries=self.getSelectedFilterValue('series_filter'))827 distroseries=self.getSelectedFilterValue('series_filter'),
828 eager_load=True)
828829
829 @property830 @property
830 def default_status_filter(self):831 def default_status_filter(self):
831832
=== modified file 'lib/lp/soyuz/interfaces/archive.py'
--- lib/lp/soyuz/interfaces/archive.py 2011-02-24 15:30:54 +0000
+++ lib/lp/soyuz/interfaces/archive.py 2011-04-12 01:45:06 +0000
@@ -987,11 +987,13 @@
987 required=False))987 required=False))
988 # Really returns ISourcePackagePublishingHistory, see below for988 # Really returns ISourcePackagePublishingHistory, see below for
989 # patch to avoid circular import.989 # patch to avoid circular import.
990 @call_with(eager_load=True)
990 @operation_returns_collection_of(Interface)991 @operation_returns_collection_of(Interface)
991 @export_read_operation()992 @export_read_operation()
992 def getPublishedSources(name=None, version=None, status=None,993 def getPublishedSources(name=None, version=None, status=None,
993 distroseries=None, pocket=None,994 distroseries=None, pocket=None,
994 exact_match=False, created_since_date=None):995 exact_match=False, created_since_date=None,
996 eager_load=False):
995 """All `ISourcePackagePublishingHistory` target to this archive.997 """All `ISourcePackagePublishingHistory` target to this archive.
996998
997 :param name: source name filter (exact match or SQL LIKE controlled999 :param name: source name filter (exact match or SQL LIKE controlled
9981000
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py 2011-03-23 18:29:09 +0000
+++ lib/lp/soyuz/model/archive.py 2011-04-12 01:45:06 +0000
@@ -465,7 +465,8 @@
465465
466 def getPublishedSources(self, name=None, version=None, status=None,466 def getPublishedSources(self, name=None, version=None, status=None,
467 distroseries=None, pocket=None,467 distroseries=None, pocket=None,
468 exact_match=False, created_since_date=None):468 exact_match=False, created_since_date=None,
469 eager_load=False):
469 """See `IArchive`."""470 """See `IArchive`."""
470 # clauses contains literal sql expressions for things that don't work471 # clauses contains literal sql expressions for things that don't work
471 # easily in storm : this method was migrated from sqlobject but some472 # easily in storm : this method was migrated from sqlobject but some
@@ -526,6 +527,8 @@
526 resultset = store.find(SourcePackagePublishingHistory,527 resultset = store.find(SourcePackagePublishingHistory,
527 *storm_clauses).order_by(528 *storm_clauses).order_by(
528 *orderBy)529 *orderBy)
530 if not eager_load:
531 return resultset
529 # Its not clear that this eager load is necessary or sufficient, it532 # Its not clear that this eager load is necessary or sufficient, it
530 # replaces a prejoin that had pathological query plans.533 # replaces a prejoin that had pathological query plans.
531 def eager_load(rows):534 def eager_load(rows):