Class: DetectRepositoryLanguagesWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker, ExceptionBacktrace, ExclusiveLeaseGuard
Defined in:
app/workers/detect_repository_languages_worker.rb

Overview

rubocop:disable Scalability/IdempotentWorker

Constant Summary collapse

LEASE_TIMEOUT =
300

Constants included from ApplicationWorker

ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT

Constants included from WorkerAttributes

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ExclusiveLeaseGuard

#exclusive_lease, #lease_release?, #log_error, #release_lease, #renew_lease!, #try_obtain_lease

Methods included from Gitlab::SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.


15
16
17
# File 'app/workers/detect_repository_languages_worker.rb', line 15

def project
  @project
end

Instance Method Details

#perform(project_id, user_id = nil) ⇒ Object


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

def perform(project_id, user_id = nil)
  @project = Project.find_by_id(project_id)
  return unless project

  try_obtain_lease do
    ::Projects::DetectRepositoryLanguagesService.new(project).execute
  end
end