Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
commitb76ae638462ab0f673e5915986070518dd3f9ad3 (patch)
treebdab0533383b52873be0ec0eb4d3c66598ff8b91 /app/workers/container_expiration_policies
parent434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff)
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'app/workers/container_expiration_policies')
-rw-r--r--app/workers/container_expiration_policies/cleanup_container_repository_worker.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/app/workers/container_expiration_policies/cleanup_container_repository_worker.rb b/app/workers/container_expiration_policies/cleanup_container_repository_worker.rb
index 33dda6a8f0c..de9bb4d5a93 100644
--- a/app/workers/container_expiration_policies/cleanup_container_repository_worker.rb
+++ b/app/workers/container_expiration_policies/cleanup_container_repository_worker.rb
@@ -4,6 +4,8 @@ module ContainerExpirationPolicies
class CleanupContainerRepositoryWorker
include ApplicationWorker
+ data_consistency :always
+
sidekiq_options retry: 3
include LimitedCapacity::Worker
include Gitlab::Utils::StrongMemoize
@@ -61,16 +63,23 @@ module ContainerExpirationPolicies
def container_repository
strong_memoize(:container_repository) do
ContainerRepository.transaction do
- # We need a lock to prevent two workers from picking up the same row
- container_repository = next_container_repository
+ repository = next_container_repository
+
+ repository&.tap do |repo|
+ log_info(
+ project_id: repo.project_id,
+ container_repository_id: repo.id
+ )
- container_repository&.tap(&:cleanup_ongoing!)
+ repo.cleanup_ongoing!
+ end
end
end
end
def next_container_repository
# rubocop: disable CodeReuse/ActiveRecord
+ # We need a lock to prevent two workers from picking up the same row
next_one_requiring = ContainerRepository.requiring_cleanup
.order(:expiration_policy_cleanup_status, :expiration_policy_started_at)
.limit(1)