2018-06-27 07:23:28 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-04-21 15:21:10 +00:00
|
|
|
class ExpirePipelineCacheWorker
|
2017-11-28 16:08:30 +00:00
|
|
|
include ApplicationWorker
|
2017-04-18 19:26:56 +00:00
|
|
|
include PipelineQueue
|
|
|
|
|
2017-11-28 16:16:50 +00:00
|
|
|
queue_namespace :pipeline_cache
|
2020-03-02 18:07:42 +00:00
|
|
|
urgency :high
|
2019-10-30 15:14:17 +00:00
|
|
|
worker_resource_boundary :cpu
|
2017-08-21 12:02:20 +00:00
|
|
|
|
2020-04-21 15:21:10 +00:00
|
|
|
idempotent!
|
|
|
|
|
2018-08-27 15:31:01 +00:00
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2017-04-20 06:44:01 +00:00
|
|
|
def perform(pipeline_id)
|
2017-04-21 15:39:19 +00:00
|
|
|
pipeline = Ci::Pipeline.find_by(id: pipeline_id)
|
2020-02-13 18:09:00 +00:00
|
|
|
return unless pipeline&.cacheable?
|
2017-04-21 15:39:19 +00:00
|
|
|
|
2019-04-12 19:29:47 +00:00
|
|
|
Ci::ExpirePipelineCacheService.new.execute(pipeline)
|
2017-04-18 19:26:56 +00:00
|
|
|
end
|
2018-08-27 15:31:01 +00:00
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2017-04-18 19:26:56 +00:00
|
|
|
end
|