Switch to an inner inner subquery to make mysql arbitrarily happy.
This commit is contained in:
parent
24ab0ae53a
commit
75d41ca371
1 changed files with 10 additions and 4 deletions
|
@ -1579,13 +1579,19 @@ def list_repository_tags(namespace_name, repository_name, include_hidden=False):
|
|||
|
||||
|
||||
def _garbage_collect_tags(namespace_name, repository_name):
|
||||
inner = (RepositoryTag
|
||||
.select(RepositoryTag.id,
|
||||
RepositoryTag.lifetime_end_ts,
|
||||
RepositoryTag.repository)
|
||||
.alias('rt'))
|
||||
to_delete = (RepositoryTag
|
||||
.select(RepositoryTag.id)
|
||||
.join(Repository)
|
||||
.select(inner.c.id)
|
||||
.from_(inner)
|
||||
.join(Repository, on=(inner.c.repository_id == Repository.id))
|
||||
.join(Namespace, on=(Repository.namespace_user == Namespace.id))
|
||||
.where(Repository.name == repository_name, Namespace.username == namespace_name,
|
||||
~(RepositoryTag.lifetime_end_ts >> None),
|
||||
(RepositoryTag.lifetime_end_ts + Namespace.removed_tag_expiration_s) <=
|
||||
~(inner.c.lifetime_end_ts >> None),
|
||||
(inner.c.lifetime_end_ts + Namespace.removed_tag_expiration_s) <=
|
||||
int(time.time())))
|
||||
|
||||
(RepositoryTag
|
||||
|
|
Reference in a new issue