Check for missing repository on GC call
Fixes https://sentry.io/coreos/backend-production/issues/192273882/
This commit is contained in:
parent
89b7c13da5
commit
ef9cb3757d
1 changed files with 9 additions and 2 deletions
|
@ -54,7 +54,10 @@ def purge_repository(namespace_name, repository_name):
|
|||
not need to be checked or responded to.
|
||||
"""
|
||||
|
||||
repo = _basequery.get_existing_repository(namespace_name, repository_name)
|
||||
try:
|
||||
repo = _basequery.get_existing_repository(namespace_name, repository_name)
|
||||
except Repository.DoesNotExist:
|
||||
return False
|
||||
|
||||
# Delete all tags to allow gc to reclaim storage
|
||||
previously_referenced = tag.purge_all_tags(repo)
|
||||
|
@ -74,7 +77,11 @@ def purge_repository(namespace_name, repository_name):
|
|||
return False
|
||||
|
||||
# Delete the rest of the repository metadata
|
||||
fetched = _basequery.get_existing_repository(namespace_name, repository_name)
|
||||
try:
|
||||
fetched = _basequery.get_existing_repository(namespace_name, repository_name)
|
||||
except Repository.DoesNotExist:
|
||||
return False
|
||||
|
||||
fetched.delete_instance(recursive=True, delete_nullable=False)
|
||||
|
||||
return True
|
||||
|
|
Reference in a new issue