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

Constants included from WorkerAttributes

WorkerAttributes::NAMESPACE_WEIGHTS, 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


9
10
11
# File 'app/workers/object_pool/create_worker.rb', line 9

def pool
  @pool
end

Instance Method Details

#perform(pool_id) ⇒ Object


11
12
13
14
15
16
17
18
# File 'app/workers/object_pool/create_worker.rb', line 11

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

  try_obtain_lease do
    perform_pool_creation
  end
end