Class: ContainerRegistry::DeleteContainerRepositoryWorker
- Inherits:
-
Object
- Object
- ContainerRegistry::DeleteContainerRepositoryWorker
- Extended by:
- Gitlab::Utils::Override
- Includes:
- ApplicationWorker, Gitlab::Utils::StrongMemoize, LimitedCapacity::Worker
- Defined in:
- app/workers/container_registry/delete_container_repository_worker.rb
Constant Summary collapse
- MAX_CAPACITY =
2
- CLEANUP_TAGS_SERVICE_PARAMS =
{ 'name_regex_delete' => '.*', 'keep_latest' => false, 'container_expiration_policy' => true # to avoid permissions checks }.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_DATA_CONSISTENCY_PER_DB, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::LOAD_BALANCED_DATA_CONSISTENCIES, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
Methods included from Gitlab::Utils::Override
extended, extensions, included, method_added, override, prepended, queue_verification, verify!
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
Instance Method Details
#max_running_jobs ⇒ Object
47 48 49 |
# File 'app/workers/container_registry/delete_container_repository_worker.rb', line 47 def max_running_jobs MAX_CAPACITY end |
#perform_work ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/workers/container_registry/delete_container_repository_worker.rb', line 24 def perform_work return unless next_container_repository result = (next_container_repository, result) if result[:status] == :error || next_container_repository. != 0 return update_next_container_repository_status end next_container_repository.destroy! audit_event(next_container_repository) rescue StandardError => exception update_next_container_repository_status Gitlab::ErrorTracking.log_exception(exception, class: self.class.name) end |
#remaining_work_count ⇒ Object
43 44 45 |
# File 'app/workers/container_registry/delete_container_repository_worker.rb', line 43 def remaining_work_count ::ContainerRepository.delete_scheduled.limit(max_running_jobs + 1).count end |