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

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

module Pages
  class DeactivateMrDeploymentsWorker
    include ApplicationWorker

    idempotent!
    data_consistency :always # rubocop: disable SidekiqLoadBalancing/WorkerDataConsistency -- performing writes only
    urgency :low

    feature_category :pages

    def perform(merge_request_id)
      build_ids = Ci::Build.ids_in_merge_request(merge_request_id)
      deactivate_deployments_with_build_ids(build_ids)
    end

    private

    def deactivate_deployments_with_build_ids(build_ids)
      PagesDeployment
        .versioned
        .ci_build_id_in(build_ids)
        .each_batch do |batch|
          batch.deactivate
        end
    end
  end
end