mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-09-18 00:44:03 +00:00
Optimize Launchpad collection handling
Various methods in `ubuntutools.lp.lpapicache` iterated over collections in a pessimal way: they fetched the collection and then fetched each individual entry in it, when the same information was already available in the collection response. Use more idiomatic launchpadlib code for this instead, which is also much faster.
This commit is contained in:
parent
7dd913fe16
commit
8bb85c6a94
4
debian/changelog
vendored
4
debian/changelog
vendored
@ -1,7 +1,11 @@
|
||||
ubuntu-dev-tools (0.207) UNRELEASED; urgency=medium
|
||||
|
||||
[ Dan Streetman ]
|
||||
* Fix pull-lp-source --upload-queue (LP: #2110061)
|
||||
|
||||
[ Colin Watson ]
|
||||
* Optimize Launchpad collection handling.
|
||||
|
||||
-- Dan Streetman <ddstreet@ieee.org> Tue, 06 May 2025 13:25:22 -0400
|
||||
|
||||
ubuntu-dev-tools (0.206) unstable; urgency=medium
|
||||
|
@ -290,9 +290,8 @@ class Distribution(BaseWrapper):
|
||||
Returns a list of all DistroSeries objects.
|
||||
"""
|
||||
if not self._have_all_series:
|
||||
for series in Launchpad.load(self.series_collection_link).entries:
|
||||
series_link = DistroSeries(series["self_link"])
|
||||
self._cache_series(series_link)
|
||||
for series in self.series:
|
||||
self._cache_series(DistroSeries(series))
|
||||
self._have_all_series = True
|
||||
|
||||
allseries = filter(lambda s: s.active, self._series.values())
|
||||
@ -1406,10 +1405,7 @@ class PersonTeam(BaseWrapper, metaclass=MetaPersonTeam):
|
||||
|
||||
def getPPAs(self):
|
||||
if self._ppas is None:
|
||||
ppas = [
|
||||
Archive(ppa["self_link"])
|
||||
for ppa in Launchpad.load(self._lpobject.ppas_collection_link).entries
|
||||
]
|
||||
ppas = [Archive(ppa) for ppa in self._lpobject.ppas]
|
||||
self._ppas = {ppa.name: ppa for ppa in ppas}
|
||||
return self._ppas
|
||||
|
||||
@ -1434,10 +1430,7 @@ class Project(BaseWrapper):
|
||||
The list will be sorted by date_created, in descending order.
|
||||
"""
|
||||
if not self._series:
|
||||
series = [
|
||||
ProjectSeries(s["self_link"])
|
||||
for s in Launchpad.load(self._lpobject.series_collection_link).entries
|
||||
]
|
||||
series = [ProjectSeries(s) for s in self._lpobject.series]
|
||||
self._series = sorted(series, key=lambda s: s.date_created, reverse=True)
|
||||
return self._series.copy()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user