summaryrefslogtreecommitdiff
path: root/lib/gitlab/database/indexing_exclusive_lease_guard.rb
blob: fb45de347e6d4760f04ec1ffae67a8a60b3f0547 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module Gitlab
  module Database
    module IndexingExclusiveLeaseGuard
      extend ActiveSupport::Concern
      include ExclusiveLeaseGuard

      def lease_key
        @lease_key ||= "gitlab/database/indexing/actions/#{database_config_name}"
      end

      def database_config_name
        Gitlab::Database.db_config_name(connection)
      end
    end
  end
end