diff --git a/data/model/tag.py b/data/model/tag.py index d24a3d0eb..a9e9285aa 100644 --- a/data/model/tag.py +++ b/data/model/tag.py @@ -612,6 +612,7 @@ def _create_manifest(tag, manifest, storage_id_map): manifest_bytes=manifest.bytes, media_type=media_type) ManifestLegacyImage.create(manifest=manifest_row, repository=tag.repository, image=tag.image) + blobs_to_insert = [] blobs_created = set() for blob_digest in reversed(manifest.blob_digests): image_storage_id = storage_id_map.get(blob_digest) @@ -622,9 +623,13 @@ def _create_manifest(tag, manifest, storage_id_map): if image_storage_id in blobs_created: continue - ManifestBlob.create(manifest=manifest_row, repository=tag.repository, blob=image_storage_id) + blobs_to_insert.append(dict(manifest=manifest_row, repository=tag.repository, + blob=image_storage_id)) blobs_created.add(image_storage_id) + if blobs_to_insert: + ManifestBlob.insert_many(blobs_to_insert).execute() + tag_manifest = TagManifest.create(tag=tag, digest=manifest.digest, json_data=manifest.bytes) TagManifestToManifest.create(tag_manifest=tag_manifest, manifest=manifest_row) return tag_manifest