Class: Quiq::Server

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/quiq/server.rb

Instance Method Summary collapse

Instance Method Details

#run!Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/quiq/server.rb', line 12

def run!
  # Launch one worker per queue
  Quiq.queues.each do |queue|
    fork { Worker.new(queue).start }
  end

  # Launch scheduler for jobs to be performed at certain time
  fork { Scheduler.instance.start }

  # Set the process name
  Process.setproctitle("quiq master #{Quiq.configuration.path}")

  # TODO: handle graceful shutdowns
  Process.waitall
end