Method: PerfectQueue::Engine#run

Defined in:
lib/perfectqueue/engine.rb

#runObject



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/perfectqueue/engine.rb', line 76

def run
  @processors.each {|c|
    c.keepalive
    # add wait time before starting processors to avoid
    # a spike of the number of concurrent connections.
    sleep rand*2  # upto 2 second, average 1 seoncd
  }
  until @finish_flag.set?
    @processors.each {|c| c.keepalive }
    @finish_flag.wait(@child_keepalive_interval)
  end
  join
end