Change blobuploadcleanupworker to use a data interface

This commit is contained in:
Joseph Schorr 2017-07-11 16:58:09 +03:00
parent b2053829f9
commit bdab367285
5 changed files with 93 additions and 21 deletions

View file

@ -88,6 +88,17 @@ def get_stale_blob_upload(stale_timespan):
return None
def get_blob_upload_by_uuid(upload_uuid):
""" Loads the upload with the given UUID, if any. """
try:
return (BlobUpload
.select()
.where(BlobUpload.uuid == upload_uuid)
.get())
except BlobUpload.DoesNotExist:
return None
def get_blob_upload(namespace, repo_name, upload_uuid):
""" Load the upload which is already in progress.
"""