Class: RepositoryCheck::DispatchWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker, CronjobQueue, EachShardWorker, ExclusiveLeaseGuard
Defined in:
app/workers/repository_check/dispatch_worker.rb

Overview

rubocop:disable Scalability/IdempotentWorker

Constant Summary collapse

LEASE_TIMEOUT =
1.hour

Constants included from ApplicationWorker

ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT

Constants included from Gitlab::Loggable

Gitlab::Loggable::ANONYMOUS

Constants included from WorkerAttributes

WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES

Instance Method Summary collapse

Methods included from ExclusiveLeaseGuard

#exclusive_lease, #lease_key, #lease_release?, #lease_taken_log_level, #lease_taken_message, #log_lease_taken, #release_lease, #renew_lease!, #try_obtain_lease

Methods included from EachShardWorker

#each_eligible_shard, #eligible_shard_names, #healthy_ready_shards, #healthy_shard_names, #ready_shards

Methods included from Gitlab::Loggable

#build_structured_payload

Methods included from Gitlab::SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Instance Method Details

#lease_timeoutObject



30
31
32
# File 'app/workers/repository_check/dispatch_worker.rb', line 30

def lease_timeout
  LEASE_TIMEOUT
end

#performObject



20
21
22
23
24
25
26
27
28
# File 'app/workers/repository_check/dispatch_worker.rb', line 20

def perform
  return unless Gitlab::CurrentSettings.repository_checks_enabled

  try_obtain_lease do
    each_eligible_shard do |shard_name|
      RepositoryCheck::BatchWorker.perform_async(shard_name)
    end
  end
end