Class: Rabbithole::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/rabbithole/cli.rb

Instance Method Summary collapse

Instance Method Details

#workObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rabbithole/cli.rb', line 9

def work
  load_environment options[:require]
  @worker = Worker.new(options[:num_workers])
  queues = options[:queues]
  queues << Rabbithole::Connection::DEFAULT_QUEUE if queues.delete('default') || queues.delete('*')
  queues.each do |queue|
    @worker.listen_to_queue(queue)
  end

  Signal.trap("INT") { shutdown }

  @worker.join
end