Module: Database::BatchedBackgroundMigration::ExecutionWorker
- Extended by:
- ActiveSupport::Concern
- Includes:
- ApplicationWorker, ExclusiveLeaseGuard, Gitlab::Utils::StrongMemoize, LimitedCapacity::Worker
- Included in:
- CiExecutionWorker, MainExecutionWorker
- Defined in:
- app/workers/database/batched_background_migration/execution_worker.rb
Constant Summary collapse
- INTERVAL_VARIANCE =
5.seconds.freeze
- LEASE_TIMEOUT_MULTIPLIER =
3
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
- #max_running_jobs ⇒ Object
- #perform_work(database_name, migration_id) ⇒ Object
- #remaining_work_count(*args) ⇒ Object
Methods included from LimitedCapacity::Worker
#perform, #remove_failed_jobs, #report_prometheus_metrics
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Methods included from ExclusiveLeaseGuard
#exclusive_lease, #lease_release?, #lease_taken_log_level, #lease_taken_message, #log_lease_taken, #release_lease, #renew_lease!, #try_obtain_lease
Instance Method Details
#max_running_jobs ⇒ Object
41 42 43 |
# File 'app/workers/database/batched_background_migration/execution_worker.rb', line 41 def max_running_jobs self.class.max_running_jobs end |
#perform_work(database_name, migration_id) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/workers/database/batched_background_migration/execution_worker.rb', line 45 def perform_work(database_name, migration_id) self.database_name = database_name return unless enabled? return if shares_db_config? Gitlab::Database::SharedModel.using_connection(base_model.connection) do self.migration = find_migration(migration_id) break unless migration try_obtain_lease do run_migration_job if executable_migration? end end end |
#remaining_work_count(*args) ⇒ Object
37 38 39 |
# File 'app/workers/database/batched_background_migration/execution_worker.rb', line 37 def remaining_work_count(*args) 0 # the cron worker is the only source of new jobs end |