Remove the transaction around creating the tag and the tag manifest
The tag manifest creation operation is now quite a bit heavier (because it is populating a bunch of new-model tables as well), and it is not necessary for the transaction to include this operation, because tags are valid without manifests currently.
This commit is contained in:
parent
f6902f8096
commit
8cdddd365b
1 changed files with 11 additions and 10 deletions
|
@ -567,17 +567,18 @@ def store_tag_manifest_for_repo(repository_id, tag_name, manifest, leaf_layer_id
|
||||||
""" Stores a tag manifest for a specific tag name in the database. Returns the TagManifest
|
""" Stores a tag manifest for a specific tag name in the database. Returns the TagManifest
|
||||||
object, as well as a boolean indicating whether the TagManifest was created.
|
object, as well as a boolean indicating whether the TagManifest was created.
|
||||||
"""
|
"""
|
||||||
with db_transaction():
|
# Create the tag for the tag manifest.
|
||||||
tag = create_or_update_tag_for_repo(repository_id, tag_name, leaf_layer_id,
|
tag = create_or_update_tag_for_repo(repository_id, tag_name, leaf_layer_id,
|
||||||
reversion=reversion)
|
reversion=reversion)
|
||||||
|
|
||||||
try:
|
# Add a tag manifest pointing to that tag.
|
||||||
manifest = TagManifest.get(digest=manifest.digest)
|
try:
|
||||||
manifest.tag = tag
|
manifest = TagManifest.get(digest=manifest.digest)
|
||||||
manifest.save()
|
manifest.tag = tag
|
||||||
return manifest, False
|
manifest.save()
|
||||||
except TagManifest.DoesNotExist:
|
return manifest, False
|
||||||
return _create_manifest(tag, manifest, storage_id_map), True
|
except TagManifest.DoesNotExist:
|
||||||
|
return _create_manifest(tag, manifest, storage_id_map), True
|
||||||
|
|
||||||
|
|
||||||
def get_active_tag(namespace, repo_name, tag_name):
|
def get_active_tag(namespace, repo_name, tag_name):
|
||||||
|
|
Reference in a new issue