Class: Clusters::Applications::DeactivateServiceWorker
- Inherits:
-
Object
- Object
- Clusters::Applications::DeactivateServiceWorker
- Includes:
- ApplicationWorker, ClusterQueue
- Defined in:
- app/workers/clusters/applications/deactivate_service_worker.rb
Overview
rubocop:disable Scalability/IdempotentWorker
Constant Summary
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY
Constants included from WorkerAttributes
WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#cluster_missing_error(service) ⇒ Object
21 22 23 |
# File 'app/workers/clusters/applications/deactivate_service_worker.rb', line 21 def cluster_missing_error(service) ActiveRecord::RecordNotFound.new("Can't deactivate #{service} services, host cluster not found! Some inconsistent records may be left in database.") end |
#perform(cluster_id, service_name) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'app/workers/clusters/applications/deactivate_service_worker.rb', line 11 def perform(cluster_id, service_name) cluster = Clusters::Cluster.find_by_id(cluster_id) raise cluster_missing_error(service_name) unless cluster service = "#{service_name}_service".to_sym cluster.all_projects.with_service(service).find_each do |project| project.public_send(service).update!(active: false) # rubocop:disable GitlabSecurity/PublicSend end end |