Close for long operation before we upload chunks

This commit is contained in:
Joseph Schorr 2015-12-07 14:07:10 -05:00
parent 4b01c915c7
commit bcd7f45905

View file

@ -190,6 +190,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:
@ -201,7 +204,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)