Class: Gitlab::Database::AsyncIndexes::IndexBase
- Inherits:
-
Object
- Object
- Gitlab::Database::AsyncIndexes::IndexBase
- Extended by:
- Utils::Override
- Defined in:
- lib/gitlab/database/async_indexes/index_base.rb
Direct Known Subclasses
Constant Summary collapse
- TIMEOUT_PER_ACTION =
1.day
Instance Method Summary collapse
-
#initialize(async_index) ⇒ IndexBase
constructor
A new instance of IndexBase.
- #perform ⇒ Object
Methods included from Utils::Override
extended, extensions, included, method_added, override, prepended, queue_verification, verify!
Methods included from Gitlab::Database::AsyncDdlExclusiveLeaseGuard
#database_config_name, #lease_key
Methods included from ExclusiveLeaseGuard
#exclusive_lease, #lease_key, #lease_release?, #lease_taken_log_level, #lease_taken_message, #log_lease_taken, #release_lease, #renew_lease!, #try_obtain_lease
Constructor Details
#initialize(async_index) ⇒ IndexBase
Returns a new instance of IndexBase.
12 13 14 |
# File 'lib/gitlab/database/async_indexes/index_base.rb', line 12 def initialize(async_index) @async_index = async_index end |
Instance Method Details
#perform ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gitlab/database/async_indexes/index_base.rb', line 16 def perform try_obtain_lease do if preconditions_met? log_index_info("Starting async index #{action_type}") execute_action_with_error_handling log_index_info("Finished async index #{action_type}") else log_index_info() async_index.destroy! end end end |