summaryrefslogtreecommitdiff
path: root/lib/gitlab/database/async_ddl_exclusive_lease_guard.rb
blob: 5742e96c9b388ad20c4b6f1de455dc71dd0955be (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 AsyncDdlExclusiveLeaseGuard
      extend ActiveSupport::Concern
      include ExclusiveLeaseGuard

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

      def database_config_name
        connection_db_config.name
      end
    end
  end
end