Method: SolidQueue::Worker#initialize

Defined in:
lib/solid_queue/worker.rb

#initialize(**options) ⇒ Worker

Returns a new instance of Worker.



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

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

  # Ensure that the queues array is deep frozen to prevent accidental modification
  @queues = Array(options[:queues]).map(&:freeze).freeze

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

  super(**options)
end