Class: Clusters::Applications::ActivateServiceWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker, ClusterQueue
Defined in:
app/workers/clusters/applications/activate_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

#job_version

Methods included from WorkerContext

#with_context

Instance Method Details

#perform(cluster_id, service_name) ⇒ Object


11
12
13
14
15
16
17
18
# File 'app/workers/clusters/applications/activate_service_worker.rb', line 11

def perform(cluster_id, service_name)
  cluster = Clusters::Cluster.find_by_id(cluster_id)
  return unless cluster

  cluster.all_projects.find_each do |project|
    project.find_or_initialize_service(service_name).update!(active: true)
  end
end