Class: ContainerRegistry::Migration::EnqueuerWorker
- Inherits:
-
Object
- Object
- ContainerRegistry::Migration::EnqueuerWorker
- Includes:
- ApplicationWorker, CronjobQueue, ExclusiveLeaseGuard, Gitlab::Utils::StrongMemoize
- Defined in:
- app/workers/container_registry/migration/enqueuer_worker.rb
Constant Summary collapse
- DEFAULT_LEASE_TIMEOUT =
30.minutes.to_i.freeze
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
Class Method Summary collapse
Instance Method Summary collapse
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
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Class Method Details
.enqueue_a_job ⇒ Object
35 36 37 |
# File 'app/workers/container_registry/migration/enqueuer_worker.rb', line 35 def self.enqueue_a_job perform_async end |
Instance Method Details
#perform ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/workers/container_registry/migration/enqueuer_worker.rb', line 19 def perform try_obtain_lease do while runnable? && Time.zone.now < loop_deadline repository_handled = handle_aborted_migration || handle_next_migration # no repository was found: stop the loop break unless repository_handled # we're going for another iteration so we need to clear memoization clear_memoization(:next_repository) clear_memoization(:next_aborted_repository) clear_memoization(:last_step_completed_repository) end end end |