2017-05-20 22:07:36 +00:00
|
|
|
class ExpireJobCacheWorker
|
2017-11-28 16:08:30 +00:00
|
|
|
include ApplicationWorker
|
2017-08-21 12:16:51 +00:00
|
|
|
include PipelineQueue
|
|
|
|
|
2017-11-28 16:16:50 +00:00
|
|
|
queue_namespace :pipeline_cache
|
2017-05-20 22:07:36 +00:00
|
|
|
|
2017-05-22 18:22:50 +00:00
|
|
|
def perform(job_id)
|
|
|
|
job = CommitStatus.joins(:pipeline, :project).find_by(id: job_id)
|
2017-05-20 22:07:36 +00:00
|
|
|
return unless job
|
|
|
|
|
|
|
|
pipeline = job.pipeline
|
|
|
|
project = job.project
|
|
|
|
|
2017-05-22 18:22:50 +00:00
|
|
|
Gitlab::EtagCaching::Store.new.tap do |store|
|
|
|
|
store.touch(project_pipeline_path(project, pipeline))
|
|
|
|
store.touch(project_job_path(project, job))
|
|
|
|
end
|
2017-05-20 22:07:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def project_pipeline_path(project, pipeline)
|
2017-06-29 17:06:35 +00:00
|
|
|
Gitlab::Routing.url_helpers.project_pipeline_path(project, pipeline, format: :json)
|
2017-05-20 22:07:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def project_job_path(project, job)
|
2017-06-29 17:06:35 +00:00
|
|
|
Gitlab::Routing.url_helpers.project_build_path(project, job.id, format: :json)
|
2017-05-20 22:07:36 +00:00
|
|
|
end
|
|
|
|
end
|