Merge pull request #675 from coreos-inc/distinctgc
Reduce GC work time and make sure to use distinct query
This commit is contained in:
commit
8e7b20a0d7
2 changed files with 2 additions and 1 deletions
|
@ -74,6 +74,7 @@ def find_repository_with_garbage():
|
||||||
(RepositoryTag.lifetime_end_ts <=
|
(RepositoryTag.lifetime_end_ts <=
|
||||||
(epoch_timestamp - Namespace.removed_tag_expiration_s)))
|
(epoch_timestamp - Namespace.removed_tag_expiration_s)))
|
||||||
.limit(500)
|
.limit(500)
|
||||||
|
.distinct()
|
||||||
.alias('candidates'))
|
.alias('candidates'))
|
||||||
|
|
||||||
found = (RepositoryTag
|
found = (RepositoryTag
|
||||||
|
|
|
@ -10,7 +10,7 @@ logger = logging.getLogger(__name__)
|
||||||
class GarbageCollectionWorker(Worker):
|
class GarbageCollectionWorker(Worker):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(GarbageCollectionWorker, self).__init__()
|
super(GarbageCollectionWorker, self).__init__()
|
||||||
self.add_operation(self._garbage_collection_repos, 10)
|
self.add_operation(self._garbage_collection_repos, 30)
|
||||||
|
|
||||||
def _garbage_collection_repos(self):
|
def _garbage_collection_repos(self):
|
||||||
""" Performs garbage collection on repositories. """
|
""" Performs garbage collection on repositories. """
|
||||||
|
|
Reference in a new issue