PR#1909: a follow-up fix for koji-gc

Merges #1909
https://pagure.io/koji/pull-request/1909

Fixes: #1697
https://pagure.io/koji/issue/1697
koji-gc: untagging/moving to trashcan is very slow
This commit is contained in:
Tomas Kopecek 2020-01-16 14:48:39 +01:00
commit 20de2b89cb

View file

@ -444,6 +444,7 @@ def handle_trash():
for binfo in untagged:
i += 1
nvr = "%(name)s-%(version)s-%(release)s" % binfo
binfo['nvr'] = nvr
if not check_package(binfo['name']):
if options.debug:
print("[%i/%i] Skipping package: %s" % (i, N, nvr))
@ -457,6 +458,7 @@ def handle_trash():
mcall.buildReferences(binfo['id'], limit=10, lazy=True)
for binfo, [refs] in six.moves.zip(continuing, mcall.call_all()):
i += 1
nvr = binfo['nvr']
#XXX - this is more data than we need
# also, this call takes waaaay longer than it should
if refs.get('tags'):
@ -530,7 +532,6 @@ def handle_trash():
#ok, go ahead add it to the list
if binfo2 is None:
binfo2 = session.getBuild(binfo['id'])
binfo2['nvr'] = nvr
print("[%i/%i] Adding build to trash list: %s" % (i, N, nvr))
to_trash.append(binfo2)