diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /app/services/container_expiration_policies | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) | |
download | gitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'app/services/container_expiration_policies')
-rw-r--r-- | app/services/container_expiration_policies/cleanup_service.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/services/container_expiration_policies/cleanup_service.rb b/app/services/container_expiration_policies/cleanup_service.rb index b9e623e2e07..69e5620d986 100644 --- a/app/services/container_expiration_policies/cleanup_service.rb +++ b/app/services/container_expiration_policies/cleanup_service.rb @@ -4,7 +4,7 @@ module ContainerExpirationPolicies class CleanupService attr_reader :repository - SERVICE_RESULT_FIELDS = %i[original_size before_truncate_size after_truncate_size before_delete_size].freeze + SERVICE_RESULT_FIELDS = %i[original_size before_truncate_size after_truncate_size before_delete_size deleted_size].freeze def initialize(repository) @repository = repository @@ -15,9 +15,15 @@ module ContainerExpirationPolicies repository.start_expiration_policy! - service_result = Projects::ContainerRepository::CleanupTagsService - .new(project, nil, policy_params.merge('container_expiration_policy' => true)) - .execute(repository) + begin + service_result = Projects::ContainerRepository::CleanupTagsService + .new(project, nil, policy_params.merge('container_expiration_policy' => true)) + .execute(repository) + rescue + repository.cleanup_unfinished! + + raise + end if service_result[:status] == :success repository.update!( @@ -25,6 +31,7 @@ module ContainerExpirationPolicies expiration_policy_started_at: nil, expiration_policy_completed_at: Time.zone.now ) + success(:finished, service_result) else repository.cleanup_unfinished! |