diff options
author | Nick Thomas <nick@gitlab.com> | 2017-05-25 14:35:33 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-05-25 14:35:33 +0300 |
commit | 8a0cd8eed1dc5faa5f7292e8dd92ae74e9abfcaf (patch) | |
tree | 25ffc1b607dd6031545dbe63730f6650a750a999 /app/workers | |
parent | b26cfbece4fe830ad13c5b88a7172d0c9ae20ad4 (diff) | |
parent | 78de1c059ac588df4ba1ef352b28e5b1c6102804 (diff) |
Merge remote-tracking branch 'ce/master' into nt/ce-to-ee-thursday
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/expire_job_cache_worker.rb | 35 | ||||
-rw-r--r-- | app/workers/expire_pipeline_cache_worker.rb | 9 |
2 files changed, 44 insertions, 0 deletions
diff --git a/app/workers/expire_job_cache_worker.rb b/app/workers/expire_job_cache_worker.rb new file mode 100644 index 00000000000..08e281e7350 --- /dev/null +++ b/app/workers/expire_job_cache_worker.rb @@ -0,0 +1,35 @@ +class ExpireJobCacheWorker + include Sidekiq::Worker + include BuildQueue + + 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) + Gitlab::Routing.url_helpers.namespace_project_pipeline_path( + project.namespace, + project, + pipeline, + format: :json) + end + + def project_job_path(project, job) + Gitlab::Routing.url_helpers.namespace_project_build_path( + project.namespace, + project, + job.id, + format: :json) + end +end diff --git a/app/workers/expire_pipeline_cache_worker.rb b/app/workers/expire_pipeline_cache_worker.rb index 603e2f1aaea..d760f5b140f 100644 --- a/app/workers/expire_pipeline_cache_worker.rb +++ b/app/workers/expire_pipeline_cache_worker.rb @@ -10,6 +10,7 @@ class ExpirePipelineCacheWorker store = Gitlab::EtagCaching::Store.new store.touch(project_pipelines_path(project)) + store.touch(project_pipeline_path(project, pipeline)) store.touch(commit_pipelines_path(project, pipeline.commit)) if pipeline.commit store.touch(new_merge_request_pipelines_path(project)) each_pipelines_merge_request_path(project, pipeline) do |path| @@ -28,6 +29,14 @@ class ExpirePipelineCacheWorker format: :json) end + def project_pipeline_path(project, pipeline) + Gitlab::Routing.url_helpers.namespace_project_pipeline_path( + project.namespace, + project, + pipeline, + format: :json) + end + def commit_pipelines_path(project, commit) Gitlab::Routing.url_helpers.pipelines_namespace_project_commit_path( project.namespace, |