Class: Clusters::Cleanup::ProjectNamespaceWorker

Inherits:
Object
  • Object
show all
Includes:
ClusterCleanupMethods
Defined in:
app/workers/clusters/cleanup/project_namespace_worker.rb

Overview

rubocop:disable Scalability/IdempotentWorker

Constant Summary

Constants included from ClusterCleanupMethods

ClusterCleanupMethods::DEFAULT_EXECUTION_LIMIT, ClusterCleanupMethods::ExceededExecutionLimitError

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, execution_count = 0) ⇒ Object


8
9
10
11
12
13
14
15
16
# File 'app/workers/clusters/cleanup/project_namespace_worker.rb', line 8

def perform(cluster_id, execution_count = 0)
  Clusters::Cluster.find_by_id(cluster_id).try do |cluster|
    break unless cluster.cleanup_removing_project_namespaces?

    break exceeded_execution_limit(cluster) if exceeded_execution_limit?(execution_count)

    Clusters::Cleanup::ProjectNamespaceService.new(cluster, execution_count).execute
  end
end