Switch to an inner inner subquery to make mysql arbitrarily happy.

This commit is contained in:
Jake Moshenko 2015-02-23 12:36:14 -05:00
parent 24ab0ae53a
commit 75d41ca371

View file

@ -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