Class: SolidQueue::Worker

Inherits:
Processes::Poller show all
Includes:
LifecycleHooks
Defined in:
lib/solid_queue/worker.rb

Instance Attribute Summary collapse

Attributes inherited from Processes::Poller

#polling_interval

Attributes inherited from Processes::Base

#name

Instance Method Summary collapse

Methods included from Processes::Runnable

#start, #stop

Methods included from Processes::Supervised

#supervised_by

Methods inherited from Processes::Base

#hostname, #kind, #pid, #stop

Methods included from AppExecutor

#handle_thread_error, #wrap_in_app_executor

Methods included from Processes::Registrable

#process_id

Methods included from Processes::Interruptible

#wake_up

Methods included from Processes::Procline

#procline

Constructor Details

#initialize(**options) ⇒ Worker

Returns a new instance of Worker.



12
13
14
15
16
17
18
19
# File 'lib/solid_queue/worker.rb', line 12

def initialize(**options)
  options = options.dup.with_defaults(SolidQueue::Configuration::WORKER_DEFAULTS)

  @queues = Array(options[:queues])
  @pool = Pool.new(options[:threads], on_idle: -> { wake_up })

  super(**options)
end

Instance Attribute Details

#poolObject

Returns the value of attribute pool.



10
11
12
# File 'lib/solid_queue/worker.rb', line 10

def pool
  @pool
end

#queuesObject

Returns the value of attribute queues.



10
11
12
# File 'lib/solid_queue/worker.rb', line 10

def queues
  @queues
end

Instance Method Details

#metadataObject



21
22
23
# File 'lib/solid_queue/worker.rb', line 21

def 
  super.merge(queues: queues.join(","), thread_pool_size: pool.size)
end