debian-mirror-gitlab/app/workers/expire_job_cache_worker.rb

30 lines
743 B
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
class ExpireJobCacheWorker
2018-03-17 18:26:18 +05:30
include ApplicationWorker
include PipelineQueue
queue_namespace :pipeline_cache
2017-08-17 22:00:37 +05:30
def perform(job_id)
job = CommitStatus.joins(:pipeline, :project).find_by(id: job_id)
return unless job
pipeline = job.pipeline
project = job.project
Gitlab::EtagCaching::Store.new.tap do |store|
store.touch(project_pipeline_path(project, pipeline))
store.touch(project_job_path(project, job))
end
end
private
def project_pipeline_path(project, pipeline)
2017-09-10 17:25:29 +05:30
Gitlab::Routing.url_helpers.project_pipeline_path(project, pipeline, format: :json)
2017-08-17 22:00:37 +05:30
end
def project_job_path(project, job)
2017-09-10 17:25:29 +05:30
Gitlab::Routing.url_helpers.project_build_path(project, job.id, format: :json)
2017-08-17 22:00:37 +05:30
end
end