diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-05-22 21:22:50 +0300 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-05-22 23:07:11 +0300 |
commit | 336635f283eab06c561134f2147a3bd1983090e1 (patch) | |
tree | 60f38b54fdba9da80f2eeca5e02e1b112a6bdcc2 /app | |
parent | da0c543e289ffc2be0b91b3257bab6f1d0d5dac3 (diff) |
Test the ExpireJobCacheWorker and related changes
These were untested by the cherry picked commit.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/commit_status.rb | 2 | ||||
-rw-r--r-- | app/workers/expire_job_cache_worker.rb | 14 |
2 files changed, 7 insertions, 9 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 957f707a733..fe63728ea23 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -89,7 +89,7 @@ class CommitStatus < ActiveRecord::Base else PipelineUpdateWorker.perform_async(pipeline.id) end - ExpireJobCacheWorker.perform_async(pipeline.id, commit_status.id) + ExpireJobCacheWorker.perform_async(commit_status.id) end end end diff --git a/app/workers/expire_job_cache_worker.rb b/app/workers/expire_job_cache_worker.rb index e3930ee9d41..08e281e7350 100644 --- a/app/workers/expire_job_cache_worker.rb +++ b/app/workers/expire_job_cache_worker.rb @@ -2,15 +2,17 @@ class ExpireJobCacheWorker include Sidekiq::Worker include BuildQueue - def perform(pipeline_id, job_id) - job = CommitStatus.joins(:pipeline, :project).find_by(id: job) + def perform(job_id) + job = CommitStatus.joins(:pipeline, :project).find_by(id: job_id) return unless job pipeline = job.pipeline project = job.project - store.touch(project_pipeline_path(project, pipeline)) - store.touch(project_job_path(project, job)) + Gitlab::EtagCaching::Store.new.tap do |store| + store.touch(project_pipeline_path(project, pipeline)) + store.touch(project_job_path(project, job)) + end end private @@ -30,8 +32,4 @@ class ExpireJobCacheWorker job.id, format: :json) end - - def store - @store ||= Gitlab::EtagCaching::Store.new - end end |