cherrypick

This commit is contained in:
Joseph Schorr 2018-10-31 12:46:58 -04:00
parent db9e0f6ba3
commit 313d03b75b

View file

@ -112,7 +112,15 @@ def _write_derived_image_to_storage(verb, derived_image, queue_file):
# Re-Initialize the storage engine because some may not respond well to forking (e.g. S3)
store = Storage(app, metric_queue, config_provider=config_provider, ip_resolver=ip_resolver)
image_path = model.get_blob_path(derived_image.blob)
store.stream_write(derived_image.blob.locations, image_path, queue_file)
try:
store.stream_write(derived_image.blob.locations, image_path, queue_file)
except IOError as ex:
logger.debug('Exception when writing %s derived image %s: %s', verb, derived_image, ex)
with database.UseThenDisconnect(app.config):
model.delete_derived_image(derived_image)
queue_file.close()