gitlab-org--gitlab-foss/app/workers/expire_build_artifacts_worker.rb

14 lines
341 B
Ruby
Raw Normal View History

2016-06-10 11:27:49 -04:00
class ExpireBuildArtifactsWorker
2016-05-18 16:21:51 -04:00
include Sidekiq::Worker
def perform
Rails.logger.info 'Cleaning old build artifacts'
2016-06-08 11:18:54 -04:00
builds = Ci::Build.with_expired_artifacts
2016-05-18 16:21:51 -04:00
builds.find_each(batch_size: 50).each do |build|
2016-06-08 11:18:54 -04:00
Rails.logger.debug "Removing artifacts build #{build.id}..."
2016-05-18 16:21:51 -04:00
build.erase_artifacts!
end
end
end