launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #18570
[Merge] lp:~cjwatson/launchpad/testfix-fix-bpph-binaryfileurls into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/testfix-fix-bpph-binaryfileurls into lp:launchpad.
Commit message:
Fix O(n) query count in BPPH.binaryFileUrls.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/testfix-fix-bpph-binaryfileurls/+merge/259138
Fix O(n) query count in BPPH.binaryFileUrls.
We need the LFC, so it's easiest to just inline the query.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/testfix-fix-bpph-binaryfileurls into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py 2015-05-14 13:23:47 +0000
+++ lib/lp/soyuz/model/publishing.py 2015-05-14 16:15:50 +0000
@@ -1056,14 +1056,18 @@
def binaryFileUrls(self, include_meta=False):
"""See `IBinaryPackagePublishingHistory`."""
+ binaries = Store.of(self).find(
+ (LibraryFileAlias, LibraryFileContent),
+ LibraryFileContent.id == LibraryFileAlias.contentID,
+ LibraryFileAlias.id == BinaryPackageFile.libraryfileID,
+ BinaryPackageFile.binarypackagerelease ==
+ BinaryPackageRelease.id,
+ BinaryPackageRelease.id == self.binarypackagereleaseID)
binary_urls = proxied_urls(
- [f.libraryfile for f in self.binarypackagerelease.files],
- self.archive)
+ [binary for binary, _ in binaries], self.archive)
if include_meta:
- meta = [(
- f.libraryfile.content.filesize,
- f.libraryfile.content.sha1,
- ) for f in self.binarypackagerelease.files]
+ meta = [
+ (content.filesize, content.sha1) for _, content in binaries]
return [dict(url=url, size=size, sha1=sha1)
for url, (size, sha1) in zip(binary_urls, meta)]
return binary_urls
Follow ups