Class: SolidQueue::Worker

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

Instance Attribute Summary collapse

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

Methods included from AppExecutor

#handle_thread_error, #wrap_in_app_executor

Methods included from Processes::Interruptible

#wake_up

Methods included from Processes::Procline

#procline

Constructor Details

#initialize(**options) ⇒ Worker

Returns a new instance of Worker.



9
10
11
12
13
14
15
# File 'lib/solid_queue/worker.rb', line 9

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

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

Instance Attribute Details

#poolObject

Returns the value of attribute pool.



7
8
9
# File 'lib/solid_queue/worker.rb', line 7

def pool
  @pool
end

#queuesObject

Returns the value of attribute queues.



7
8
9
# File 'lib/solid_queue/worker.rb', line 7

def queues
  @queues
end

Instance Method Details

#metadataObject



17
18
19
# File 'lib/solid_queue/worker.rb', line 17

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