Increase nginx proxy timeout and close db before storage operation
This commit is contained in:
parent
597d6ecd3c
commit
8781cf6e11
2 changed files with 13 additions and 10 deletions
|
@ -64,6 +64,8 @@ location ~ ^/v2 {
|
|||
|
||||
proxy_request_buffering off;
|
||||
|
||||
proxy_read_timeout 300;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
|
||||
proxy_pass http://registry_app_server;
|
||||
|
|
|
@ -215,19 +215,20 @@ def _finish_upload(namespace, repo_name, upload_obj, expected_digest):
|
|||
if not digest_tools.digests_equal(computed_digest, expected_digest):
|
||||
raise BlobUploadInvalid()
|
||||
|
||||
# Move the storage into place, or if this was a re-upload, cancel it
|
||||
final_blob_location = digest_tools.content_path(expected_digest)
|
||||
|
||||
if storage.exists({upload_obj.location.name}, final_blob_location):
|
||||
# It already existed, clean up our upload which served as proof that we had the file
|
||||
storage.cancel_chunked_upload({upload_obj.location.name}, upload_obj.uuid,
|
||||
upload_obj.storage_metadata)
|
||||
# Move the storage into place, or if this was a re-upload, cancel it
|
||||
with database.CloseForLongOperation(app.config):
|
||||
if storage.exists({upload_obj.location.name}, final_blob_location):
|
||||
# It already existed, clean up our upload which served as proof that we had the file
|
||||
storage.cancel_chunked_upload({upload_obj.location.name}, upload_obj.uuid,
|
||||
upload_obj.storage_metadata)
|
||||
|
||||
else:
|
||||
# We were the first ones to upload this image (at least to this location)
|
||||
# Let's copy it into place
|
||||
storage.complete_chunked_upload({upload_obj.location.name}, upload_obj.uuid,
|
||||
final_blob_location, upload_obj.storage_metadata)
|
||||
else:
|
||||
# We were the first ones to upload this image (at least to this location)
|
||||
# Let's copy it into place
|
||||
storage.complete_chunked_upload({upload_obj.location.name}, upload_obj.uuid,
|
||||
final_blob_location, upload_obj.storage_metadata)
|
||||
|
||||
# Mark the blob as uploaded.
|
||||
model.blob.store_blob_record_and_temp_link(namespace, repo_name, expected_digest,
|
||||
|
|
Reference in a new issue