gitlab-org--gitlab-foss/app/workers/expire_build_artifacts_worker.rb
2016-06-13 11:07:23 +01:00

13 lines
341 B
Ruby

class ExpireBuildArtifactsWorker
include Sidekiq::Worker
def perform
Rails.logger.info 'Cleaning old build artifacts'
builds = Ci::Build.with_expired_artifacts
builds.find_each(batch_size: 50).each do |build|
Rails.logger.debug "Removing artifacts build #{build.id}..."
build.erase_artifacts!
end
end
end