2023-03-17 16:20:25 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Database
|
2023-04-23 21:23:45 +05:30
|
|
|
module AsyncDdlExclusiveLeaseGuard
|
2023-03-17 16:20:25 +05:30
|
|
|
extend ActiveSupport::Concern
|
|
|
|
include ExclusiveLeaseGuard
|
|
|
|
|
|
|
|
def lease_key
|
2023-04-23 21:23:45 +05:30
|
|
|
@lease_key ||= "gitlab/database/asyncddl/actions/#{database_config_name}"
|
2023-03-17 16:20:25 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def database_config_name
|
2023-04-23 21:23:45 +05:30
|
|
|
connection_db_config.name
|
2023-03-17 16:20:25 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|