summaryrefslogtreecommitdiff
path: root/app/workers/expire_build_artifacts_worker.rb
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2019-01-17 15:06:37 +0900
committerShinya Maeda <shinya@gitlab.com>2019-01-24 20:50:42 +0900
commit3cc3650dfee5132c120b2b418918f12b3eebcde2 (patch)
tree0497feec4829ed16e0b0d37954b0998a4d8fac15 /app/workers/expire_build_artifacts_worker.rb
parent490eeb5159945107576c756b22c08f99b45a8463 (diff)
downloadgitlab-ce-3cc3650dfee5132c120b2b418918f12b3eebcde2.tar.gz
Remove expired artifacts periodically
Rename Introduce Destroy expired job artifacts service Revert a bit Add changelog Use expired Improve Fix spec Fix spec Use bang for destroy Introduce iteration limit Update comment Simplify more Refacor Remove unnecessary thing Fix comments Fix coding offence Make loop helper exception free
Diffstat (limited to 'app/workers/expire_build_artifacts_worker.rb')
-rw-r--r--app/workers/expire_build_artifacts_worker.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/workers/expire_build_artifacts_worker.rb b/app/workers/expire_build_artifacts_worker.rb
index dce812d1ae2..251e95c68d5 100644
--- a/app/workers/expire_build_artifacts_worker.rb
+++ b/app/workers/expire_build_artifacts_worker.rb
@@ -4,8 +4,20 @@ class ExpireBuildArtifactsWorker
include ApplicationWorker
include CronjobQueue
- # rubocop: disable CodeReuse/ActiveRecord
def perform
+ if Feature.enabled?(:ci_new_expire_job_artifacts_service, default_enabled: true)
+ perform_efficient_artifacts_removal
+ else
+ perform_legacy_artifacts_removal
+ end
+ end
+
+ def perform_efficient_artifacts_removal
+ Ci::DestroyExpiredJobArtifactsService.new.execute
+ end
+
+ # rubocop: disable CodeReuse/ActiveRecord
+ def perform_legacy_artifacts_removal
Rails.logger.info 'Scheduling removal of build artifacts'
build_ids = Ci::Build.with_expired_artifacts.pluck(:id)