Class: ContainerRegistry::Migration::ObserverWorker
- Inherits:
-
Object
- Object
- ContainerRegistry::Migration::ObserverWorker
- Includes:
- ApplicationWorker, CronjobQueue
- Defined in:
- app/workers/container_registry/migration/observer_worker.rb
Constant Summary collapse
- COUNT_BATCH_SIZE =
50000
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
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#perform ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/workers/container_registry/migration/observer_worker.rb', line 18 def perform return unless ::ContainerRegistry::Migration.enabled? use_replica_if_available do ContainerRepository::MIGRATION_STATES.each do |state| relation = ContainerRepository.with_migration_state(state) count = ::Gitlab::Database::BatchCount.batch_count( relation, batch_size: COUNT_BATCH_SIZE ) name = "#{state}_count".to_sym (name, count) end end end |