Class: Packages::Npm::ProcessTemporaryPackageFileWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker, ErrorHandling
Defined in:
app/workers/packages/npm/process_temporary_package_file_worker.rb

Constant Summary collapse

GLOBAL_ID_LOCATE_OPTIONS =
{ only: [::User, ::DeployToken] }.freeze

Constants included from ErrorHandling

ErrorHandling::CONTROLLED_ERRORS, ErrorHandling::DEFAULT_STATUS_MESSAGE

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_CONCURRENCY_LIMIT_PERCENTAGE_BY_URGENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY_PER_DB, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::LOAD_BALANCED_DATA_CONSISTENCIES, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES

Instance Method Summary collapse

Methods included from ErrorHandling

#process_package_error_service_response, #process_package_file_error

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

#perform(user_gid, package_file_id, deprecate) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/workers/packages/npm/process_temporary_package_file_worker.rb', line 17

def perform(user_gid, package_file_id, deprecate)
  user = safe_locate(user_gid)
  return unless user

  package_file = ::Packages::PackageFile.processing.find_by_id(package_file_id)
  return unless package_file

  params = { deprecate: }

  response = ::Packages::Npm::ProcessTemporaryPackageFileService.new(package_file:, user:, params:).execute
  process_package_error_service_response(package_file: package_file, message: response.message) if response.error?
rescue StandardError => exception
  raise exception unless package_file

  process_package_file_error(package_file: package_file, exception: exception)
end