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

expire_job_cache_worker.rb « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 14a57b90114c7fa3bbe660851637574d0363c153 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

class ExpireJobCacheWorker
  include ApplicationWorker
  include PipelineQueue

  queue_namespace :pipeline_cache

  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.project_pipeline_path(project, pipeline, format: :json)
  end

  def project_job_path(project, job)
    Gitlab::Routing.url_helpers.project_build_path(project, job.id, format: :json)
  end
end