summaryrefslogtreecommitdiff
path: root/app/workers/database/ci_namespace_mirrors_consistency_check_worker.rb
blob: 2b4253947acd007e451ed62c3c82271c612dc7d9 (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
# frozen_string_literal: true

module Database
  class CiNamespaceMirrorsConsistencyCheckWorker
    include ApplicationWorker
    include CronjobQueue # rubocop: disable Scalability/CronWorkerContext

    sidekiq_options retry: false
    feature_category :sharding
    data_consistency :sticky
    idempotent!

    version 1

    def perform
      return if Feature.disabled?(:ci_namespace_mirrors_consistency_check, default_enabled: :yaml)

      results = ConsistencyCheckService.new(
        source_model: Namespace,
        target_model: Ci::NamespaceMirror,
        source_columns: %w[id traversal_ids],
        target_columns: %w[namespace_id traversal_ids]
      ).execute

      log_extra_metadata_on_done(:results, results)
    end
  end
end