diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-30 09:09:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-30 09:09:35 +0300 |
commit | 0eeb1736417d4768a1e2ee34b62f25c1f591c6ca (patch) | |
tree | 0f241bc7f3528db8696990549a1cbea33f15dd51 /app/workers | |
parent | 38d957659e97aa3c0a02f4323d92ca30dbd2c015 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/container_expiration_policy_worker.rb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/app/workers/container_expiration_policy_worker.rb b/app/workers/container_expiration_policy_worker.rb index b855d2a6998..5ca89179099 100644 --- a/app/workers/container_expiration_policy_worker.rb +++ b/app/workers/container_expiration_policy_worker.rb @@ -29,13 +29,15 @@ class ContainerExpirationPolicyWorker # rubocop:disable Scalability/IdempotentWo def perform_throttled try_obtain_lease do - with_runnable_policy do |policy| - ContainerExpirationPolicy.transaction do - policy.schedule_next_run! - ContainerRepository.for_project_id(policy.id) - .each_batch do |relation| - relation.update_all(expiration_policy_cleanup_status: :cleanup_scheduled) - end + unless loopless_enabled? + with_runnable_policy do |policy| + ContainerExpirationPolicy.transaction do + policy.schedule_next_run! + ContainerRepository.for_project_id(policy.id) + .each_batch do |relation| + relation.update_all(expiration_policy_cleanup_status: :cleanup_scheduled) + end + end end end @@ -75,6 +77,10 @@ class ContainerExpirationPolicyWorker # rubocop:disable Scalability/IdempotentWo Feature.enabled?(:container_registry_expiration_policies_throttling) end + def loopless_enabled? + Feature.enabled?(:container_registry_expiration_policies_loopless) + end + def lease_timeout 5.hours end |