gitlab-org--gitlab-foss/app/workers/expire_pipeline_cache_worker.rb
Stan Hu 1625979653 Properly expire all pipeline caches when pipeline is deleted
When deleting a pipeline, only some of the cache structures were being
expired, but not the full pipeline list. We have to synchronously
schedule a pipeline cache expiration because the pipeline will be
deleted if the Sidekiq expiration job picks it up. To do this, properly
extract all the logic buried in the Sidekiq worker into a service, and
then call the service.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/60469
2019-04-15 08:10:10 -07:00

17 lines
413 B
Ruby

# frozen_string_literal: true
class ExpirePipelineCacheWorker
include ApplicationWorker
include PipelineQueue
queue_namespace :pipeline_cache
# rubocop: disable CodeReuse/ActiveRecord
def perform(pipeline_id)
pipeline = Ci::Pipeline.find_by(id: pipeline_id)
return unless pipeline
Ci::ExpirePipelineCacheService.new.execute(pipeline)
end
# rubocop: enable CodeReuse/ActiveRecord
end