Method: PerfectQueue::Worker#initialize

Defined in:
lib/perfectqueue/worker.rb

#initialize(runner, config = nil, &block) ⇒ Worker

Returns a new instance of Worker.



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/perfectqueue/worker.rb', line 26

def initialize(runner, config=nil, &block)
  block = Proc.new { config } if config
  config = block.call

  @config = config
  @runner = runner

  @detach_wait = config[:detach_wait] || config['detach_wait'] || 10.0

  @sv = Supervisor.new(runner, &block)
  @detach = false
  @finish_flag = BlockingFlag.new
end