diff --git a/endpoints/v2/blob.py b/endpoints/v2/blob.py index c3eabef38..8f6a43277 100644 --- a/endpoints/v2/blob.py +++ b/endpoints/v2/blob.py @@ -95,16 +95,16 @@ def download_blob(namespace_name, repo_name, digest): # Close the database connection before we stream the download. logger.debug('Closing database connection before streaming layer data') - database.close_db_filter(None) + with database.CloseForLongOperation(app.config): + # Stream the response to the Docker client. + return Response( + storage.stream_read(blob.locations, path), + headers=headers.update({ + 'Content-Length': blob.size, + 'Content-Type': BLOB_CONTENT_TYPE, + }), + ) - # Stream the response to the Docker client. - return Response( - storage.stream_read(blob.locations, path), - headers=headers.update({ - 'Content-Length': blob.size, - 'Content-Type': BLOB_CONTENT_TYPE, - }), - ) @v2_bp.route('//blobs/uploads/', methods=['POST'])