Class: WorkItems::UpdateNamespaceTraversalIdsWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker, Gitlab::ExclusiveLeaseHelpers
Defined in:
app/workers/work_items/update_namespace_traversal_ids_worker.rb

Constant Summary collapse

RETRY_IN_IF_LOCKED =
20.seconds

Constants included from Gitlab::ExclusiveLeaseHelpers

Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError

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 Gitlab::ExclusiveLeaseHelpers

#in_lock

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(namespace_id) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/workers/work_items/update_namespace_traversal_ids_worker.rb', line 18

def perform(namespace_id)
  namespace = Namespace.find_by_id(namespace_id)
  return unless namespace
  return unless Feature.enabled?(:update_work_item_traversal_ids_on_transfer, namespace)

  UpdateNamespaceTraversalIdsService.execute(namespace)
rescue Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError
  logger.info(
    class: self.class.name,
    message: "Couldn't obtain the lock. Rescheduling the job.",
    namespace_id: namespace_id)

  self.class.perform_in(RETRY_IN_IF_LOCKED, namespace_id)
end