Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-05-21 01:07:36 +0300
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-05-22 23:07:11 +0300
commitda0c543e289ffc2be0b91b3257bab6f1d0d5dac3 (patch)
treebb38c9f317e237d1a4b242b6a0e74d1bdc4349ac /app/workers/expire_job_cache_worker.rb
parent33961ee418e861a021d7f70bdb1540de9d159b95 (diff)
Add MISSING e-tag refresh of resource for Job, and Pipeline Graph
Diffstat (limited to 'app/workers/expire_job_cache_worker.rb')
-rw-r--r--app/workers/expire_job_cache_worker.rb37
1 files changed, 37 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..e3930ee9d41
--- /dev/null
+++ b/app/workers/expire_job_cache_worker.rb
@@ -0,0 +1,37 @@
+class ExpireJobCacheWorker
+ include Sidekiq::Worker
+ include BuildQueue
+
+ def perform(pipeline_id, job_id)
+ job = CommitStatus.joins(:pipeline, :project).find_by(id: job)
+ return unless job
+
+ pipeline = job.pipeline
+ project = job.project
+
+ store.touch(project_pipeline_path(project, pipeline))
+ store.touch(project_job_path(project, job))
+ 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
+
+ def store
+ @store ||= Gitlab::EtagCaching::Store.new
+ end
+end