Class: Packages::Cleanup::ExecutePolicyWorker
- Inherits:
-
Object
- Object
- Packages::Cleanup::ExecutePolicyWorker
- Includes:
- ApplicationWorker, Gitlab::Utils::StrongMemoize, LimitedCapacity::Worker
- Defined in:
- app/workers/packages/cleanup/execute_policy_worker.rb
Constant Summary collapse
- COUNTS_KEYS =
%i[ marked_package_files_total_count unique_package_id_and_file_name_total_count ].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 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
44 45 46 |
# File 'app/workers/packages/cleanup/execute_policy_worker.rb', line 44 def max_running_jobs ::Gitlab::CurrentSettings.package_registry_cleanup_policies_worker_capacity end |
#perform_work ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/workers/packages/cleanup/execute_policy_worker.rb', line 22 def perform_work return unless next_policy (:project_id, next_policy.project_id) result = ::Packages::Cleanup::ExecutePolicyService.new(next_policy).execute if result.success? timeout = !!result.payload[:timeout] counts = result.payload[:counts] (:execution_timeout, timeout) COUNTS_KEYS.each do |count_key| (count_key, counts[count_key]) end end end |