Class: ObjectPool::CreateWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker, ExclusiveLeaseGuard, ObjectPoolQueue
Defined in:
app/workers/object_pool/create_worker.rb

Overview

rubocop:disable Scalability/IdempotentWorker

Constant Summary

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

#poolObject (readonly)

Returns the value of attribute pool.


13
14
15
# File 'app/workers/object_pool/create_worker.rb', line 13

def pool
  @pool
end

Instance Method Details

#perform(pool_id) ⇒ Object


15
16
17
18
19
20
21
22
# File 'app/workers/object_pool/create_worker.rb', line 15

def perform(pool_id)
  @pool = PoolRepository.find_by_id(pool_id)
  return unless pool

  try_obtain_lease do
    perform_pool_creation
  end
end