2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-08-24 11:10:36 -04:00
|
|
|
class ExpireJobCacheWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2021-04-30 14:10:09 -04:00
|
|
|
|
2021-08-26 11:10:41 -04:00
|
|
|
data_consistency :delayed
|
2021-07-21 08:09:35 -04:00
|
|
|
|
2021-04-30 14:10:09 -04:00
|
|
|
sidekiq_options retry: 3
|
2017-08-21 08:16:51 -04:00
|
|
|
include PipelineQueue
|
|
|
|
|
2017-11-28 11:16:50 -05:00
|
|
|
queue_namespace :pipeline_cache
|
2020-03-02 13:07:42 -05:00
|
|
|
urgency :high
|
2021-09-29 11:11:47 -04:00
|
|
|
idempotent!
|
2017-05-20 18:07:36 -04:00
|
|
|
|
2017-05-22 14:22:50 -04:00
|
|
|
def perform(job_id)
|
2021-12-03 07:10:23 -05:00
|
|
|
job = CommitStatus.find_by_id(job_id)
|
2017-05-20 18:07:36 -04:00
|
|
|
return unless job
|
|
|
|
|
2021-12-03 07:10:23 -05:00
|
|
|
job.expire_etag_cache!
|
|
|
|
ExpirePipelineCacheWorker.perform_async(job.pipeline_id)
|
2017-05-20 18:07:36 -04:00
|
|
|
end
|
|
|
|
end
|