launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02931
[Merge] lp:~lifeless/launchpad/bug-711104 into lp:launchpad
Robert Collins has proposed merging lp:~lifeless/launchpad/bug-711104 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #711104 in Launchpad itself: "Person:+uploaded-packages timeouts"
https://bugs.launchpad.net/launchpad/+bug/711104
For more details, see:
https://code.launchpad.net/~lifeless/launchpad/bug-711104/+merge/53188
Eager load PackageBuild and BuildFarmJob for +uploaded-packages
--
https://code.launchpad.net/~lifeless/launchpad/bug-711104/+merge/53188
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~lifeless/launchpad/bug-711104 into lp:launchpad.
=== modified file 'lib/lp/soyuz/interfaces/binarypackagebuild.py'
--- lib/lp/soyuz/interfaces/binarypackagebuild.py 2011-01-24 20:57:37 +0000
+++ lib/lp/soyuz/interfaces/binarypackagebuild.py 2011-03-14 02:29:58 +0000
@@ -353,6 +353,8 @@
buildstate=None):
"""Return all builds related with the given list of source releases.
+ Eager loads the PackageBuild and BuildFarmJob records for the builds.
+
:param sourcepackagerelease_ids: list of `ISourcePackageRelease`s;
:param buildstate: option build state filter.
=== modified file 'lib/lp/soyuz/model/binarypackagebuild.py'
--- lib/lp/soyuz/model/binarypackagebuild.py 2011-01-26 21:22:49 +0000
+++ lib/lp/soyuz/model/binarypackagebuild.py 2011-03-14 02:29:58 +0000
@@ -19,6 +19,7 @@
Desc,
Join,
LeftJoin,
+ SQL,
)
from storm.locals import (
Int,
@@ -57,6 +58,7 @@
from canonical.launchpad.interfaces.lpstorm import (
IMasterObject,
ISlaveStore,
+ IStore,
)
from canonical.launchpad.mail import (
format_address,
@@ -1101,6 +1103,8 @@
if (sourcepackagerelease_ids is None or
len(sourcepackagerelease_ids) == 0):
return []
+ # Circular.
+ from lp.soyuz.model.archive import Archive
query = """
source_package_release IN %s AND
@@ -1113,9 +1117,13 @@
if buildstate is not None:
query += "AND buildfarmjob.status = %s" % sqlvalues(buildstate)
- return BinaryPackageBuild.select(
- query, orderBy=["-buildfarmjob.date_created", "id"],
- clauseTables=["Archive", "PackageBuild", "BuildFarmJob"])
+ resultset = IStore(BinaryPackageBuild).using(
+ BinaryPackageBuild, PackageBuild, BuildFarmJob, Archive).find(
+ (BinaryPackageBuild, PackageBuild, BuildFarmJob),
+ SQL(query))
+ resultset.order_by(
+ Desc(BuildFarmJob.date_created), BinaryPackageBuild.id)
+ return DecoratedResultSet(resultset, operator.itemgetter(0))
def getStatusSummaryForBuilds(self, builds):
"""See `IBinaryPackageBuildSet`."""
Follow ups