Merge pull request #1035 from coreos-inc/closeforlong

Close for long operation before we upload chunks
This commit is contained in:
josephschorr 2015-12-07 14:22:29 -05:00
commit 6c897a7c22

View file

@ -196,6 +196,9 @@ def _upload_chunk(namespace, repo_name, upload_uuid):
if start_offset > 0 and start_offset > found.byte_count:
_range_not_satisfiable(found.byte_count)
location_set = {found.location.name}
with database.CloseForLongOperation(app.config):
input_fp = get_input_stream(request)
if start_offset > 0 and start_offset < found.byte_count:
@ -207,7 +210,7 @@ def _upload_chunk(namespace, repo_name, upload_uuid):
input_fp = wrap_with_handler(input_fp, found.sha_state.update)
try:
length_written, new_metadata = storage.stream_upload_chunk({found.location.name}, upload_uuid,
length_written, new_metadata = storage.stream_upload_chunk(location_set, upload_uuid,
start_offset, length, input_fp,
found.storage_metadata,
content_type=BLOB_CONTENT_TYPE)