diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /app/services/ci/job_artifacts/destroy_all_expired_service.rb | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'app/services/ci/job_artifacts/destroy_all_expired_service.rb')
-rw-r--r-- | app/services/ci/job_artifacts/destroy_all_expired_service.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/app/services/ci/job_artifacts/destroy_all_expired_service.rb b/app/services/ci/job_artifacts/destroy_all_expired_service.rb index c089567ec14..4070875ffe1 100644 --- a/app/services/ci/job_artifacts/destroy_all_expired_service.rb +++ b/app/services/ci/job_artifacts/destroy_all_expired_service.rb @@ -7,16 +7,14 @@ module Ci include ::Gitlab::LoopHelpers BATCH_SIZE = 100 + LOOP_LIMIT = 500 LOOP_TIMEOUT = 5.minutes - SMALL_LOOP_LIMIT = 100 - LARGE_LOOP_LIMIT = 500 - EXCLUSIVE_LOCK_KEY = 'expired_job_artifacts:destroy:lock' LOCK_TIMEOUT = 6.minutes + EXCLUSIVE_LOCK_KEY = 'expired_job_artifacts:destroy:lock' def initialize @removed_artifacts_count = 0 @start_at = Time.current - @loop_limit = ::Feature.enabled?(:ci_artifact_fast_removal_large_loop_limit, default_enabled: :yaml) ? LARGE_LOOP_LIMIT : SMALL_LOOP_LIMIT end ## @@ -26,8 +24,6 @@ module Ci # preventing multiple `ExpireBuildArtifactsWorker` CRON jobs run concurrently, # which is scheduled every 7 minutes. def execute - return 0 unless ::Feature.enabled?(:ci_destroy_all_expired_service, default_enabled: :yaml) - in_lock(EXCLUSIVE_LOCK_KEY, ttl: LOCK_TIMEOUT, retries: 1) do if ::Feature.enabled?(:ci_destroy_unlocked_job_artifacts) destroy_unlocked_job_artifacts @@ -42,7 +38,7 @@ module Ci private def destroy_unlocked_job_artifacts - loop_until(timeout: LOOP_TIMEOUT, limit: @loop_limit) do + loop_until(timeout: LOOP_TIMEOUT, limit: LOOP_LIMIT) do artifacts = Ci::JobArtifact.expired_before(@start_at).artifact_unlocked.limit(BATCH_SIZE) service_response = destroy_batch(artifacts) @removed_artifacts_count += service_response[:destroyed_artifacts_count] @@ -59,7 +55,7 @@ module Ci @removed_artifacts_count += service_response[:destroyed_artifacts_count] break if loop_timeout? - break if index >= @loop_limit + break if index >= LOOP_LIMIT end end |