From 5830d1143dbf6b2958153233279896961e9a44df Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 5 Sep 2018 23:33:30 -0700 Subject: Delete a container registry asynchronously When a container registry has many tags, it's easy for the DELETE call to take more than 60 seconds and fail. This can also leave the registry in a bad state with null bytes since some of the images have been deleted with tags still pointing to them. In addition, we have to prevent users from accidentally initiating the delete multiple times or this could leave the registry with orphaned tags. This commit also adds a flash message to notify the user the registry is scheduled for deletion. Closes #49926, #51063 --- .../projects/container_repository/destroy_service.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/services/projects/container_repository/destroy_service.rb (limited to 'app/services') diff --git a/app/services/projects/container_repository/destroy_service.rb b/app/services/projects/container_repository/destroy_service.rb new file mode 100644 index 00000000000..a8e7eab6068 --- /dev/null +++ b/app/services/projects/container_repository/destroy_service.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Projects + module ContainerRepository + class DestroyService < BaseService + def execute(container_repository) + return false unless can?(current_user, :update_container_image, project) + + container_repository.destroy + end + end + end +end -- cgit v1.2.1