Add additional assertions and further checks in storage code

This commit is contained in:
Joseph Schorr 2019-02-20 12:05:21 -05:00
parent 6b30702699
commit 693e47e063
3 changed files with 8 additions and 2 deletions

View file

@ -489,7 +489,8 @@ def find_or_create_derived_storage(source_image, transformation_name, preferred_
transformation=trans, uniqueness_hash=uniqueness_hash)
except IntegrityError:
# Storage was created while this method executed. Just return the existing.
new_storage.delete_instance(recursive=True)
ImageStoragePlacement.delete().where(ImageStoragePlacement.storage == new_storage).execute()
new_storage.delete_instance()
return find_derived_storage_for_image(source_image, transformation_name, varying_metadata)
return derived