Merge pull request #1820 from jakedt/barelyoptimize

Remove a join to slightly optimize the gc query.
This commit is contained in:
Jake Moshenko 2016-09-09 17:21:51 -04:00 committed by GitHub
commit 14795f0f62

View file

@ -163,11 +163,10 @@ def garbage_collect_repo(repo, extra_candidate_set=None):
.where(RepositoryTag.repository == repo.id,
Candidate.id << candidates_orphans))
direct_referenced = (Candidate
.select(Candidate.id)
.join(RepositoryTag)
direct_referenced = (RepositoryTag
.select(RepositoryTag.image)
.where(RepositoryTag.repository == repo.id,
Candidate.id << candidates_orphans))
RepositoryTag.image << candidates_orphans))
referenced_candidates = (direct_referenced | ancestor_referenced)