diff options
author | Robert Speicher <robert@gitlab.com> | 2018-09-07 20:26:51 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-09-07 20:26:51 +0000 |
commit | c014f7fd4ce82e9b4a907eab3915702053f0557f (patch) | |
tree | 299f39775865394977fce10b5caaf16a781c994e /app/controllers | |
parent | 9d895a73d4e2a034a6bbf6389d12fda1baba888f (diff) | |
parent | 5830d1143dbf6b2958153233279896961e9a44df (diff) | |
download | gitlab-ce-c014f7fd4ce82e9b4a907eab3915702053f0557f.tar.gz |
Merge branch 'sh-delete-container-registry-async' into 'master'
Delete a container registry asynchronously
Closes #51063 and #49926
See merge request gitlab-org/gitlab-ce!21553
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/registry/repositories_controller.rb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/app/controllers/projects/registry/repositories_controller.rb b/app/controllers/projects/registry/repositories_controller.rb index 32c0fc6d14a..ef0433795f4 100644 --- a/app/controllers/projects/registry/repositories_controller.rb +++ b/app/controllers/projects/registry/repositories_controller.rb @@ -18,14 +18,10 @@ module Projects end def destroy - if image.destroy - respond_to do |format| - format.json { head :no_content } - end - else - respond_to do |format| - format.json { head :bad_request } - end + DeleteContainerRepositoryWorker.perform_async(current_user.id, image.id) + + respond_to do |format| + format.json { head :no_content } end end @@ -41,10 +37,10 @@ module Projects # Needed to maintain a backwards compatibility. # def ensure_root_container_repository! - ContainerRegistry::Path.new(@project.full_path).tap do |path| + ::ContainerRegistry::Path.new(@project.full_path).tap do |path| break if path.has_repository? - ContainerRepository.build_from_path(path).tap do |repository| + ::ContainerRepository.build_from_path(path).tap do |repository| repository.save! if repository.has_tags? end end |