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

unlock_previous_pipelines_worker.rb « refs « ci « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bf595590cb122261a99adc6f49c5475e5fcab438 (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
# frozen_string_literal: true

module Ci
  module Refs
    class UnlockPreviousPipelinesWorker
      include ApplicationWorker

      data_consistency :always # rubocop:disable SidekiqLoadBalancing/WorkerDataConsistency

      sidekiq_options retry: 3
      include PipelineBackgroundQueue

      idempotent!

      def perform(ref_id)
        ::Ci::Ref.find_by_id(ref_id).try do |ref|
          pipeline = ref.last_finished_pipeline
          result = ::Ci::Refs::EnqueuePipelinesToUnlockService.new.execute(ref, before_pipeline: pipeline)

          log_extra_metadata_on_done(:total_pending_entries, result[:total_pending_entries])
          log_extra_metadata_on_done(:total_new_entries, result[:total_new_entries])
        end
      end
    end
  end
end