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

Constants included from WorkerAttributes

WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES

Instance Method Summary collapse

Methods included from ExclusiveLeaseGuard

#exclusive_lease, #lease_key, #lease_release?, #log_error, #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::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods included from Gitlab::SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Instance Method Details

#lease_timeoutObject


27
28
29
# File 'app/workers/repository_check/dispatch_worker.rb', line 27

def lease_timeout
  LEASE_TIMEOUT
end

#performObject


17
18
19
20
21
22
23
24
25
# File 'app/workers/repository_check/dispatch_worker.rb', line 17

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