summaryrefslogtreecommitdiff
path: root/app/services/projects/container_repository
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-09-13 22:02:04 -0700
committerStan Hu <stanhu@gmail.com>2018-09-19 05:03:18 -0700
commita1912ccc894386b112faba2932f1dd98c03aea0e (patch)
tree82eee97163f1802be69cd5810fe04bec96ae2689 /app/services/projects/container_repository
parentc6660e61b267dafe7e4f6ce2b4e38b644e7b2177 (diff)
downloadgitlab-ce-a1912ccc894386b112faba2932f1dd98c03aea0e.tar.gz
Delete container repository tags outside of transaction
When there are many tags in a container repository, deleting them can exceed the default 60 second idle-in-transaction timeout in Sidekiq. We now explicitly delete them in the DestroyService before destroying the model. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/51380
Diffstat (limited to 'app/services/projects/container_repository')
-rw-r--r--app/services/projects/container_repository/destroy_service.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/services/projects/container_repository/destroy_service.rb b/app/services/projects/container_repository/destroy_service.rb
index a8e7eab6068..1f5af7970d6 100644
--- a/app/services/projects/container_repository/destroy_service.rb
+++ b/app/services/projects/container_repository/destroy_service.rb
@@ -6,6 +6,8 @@ module Projects
def execute(container_repository)
return false unless can?(current_user, :update_container_image, project)
+ # Delete tags outside of the transaction to avoid hitting an idle-in-transaction timeout
+ container_repository.delete_tags!
container_repository.destroy
end
end