lib/qs/daemon.rb in qs-0.2.0 vs lib/qs/daemon.rb in qs-0.3.0

- old
+ new

@@ -69,11 +69,15 @@ def running? !!(@work_loop_thread && @work_loop_thread.alive?) end + # * Ping redis to check that it can communicate with redis before running, + # this is friendlier than starting and continously erroring because it + # can't dequeue. def start + @client.ping @signal.set :start @work_loop_thread ||= Thread.new{ work_loop } end def stop(wait = false) @@ -158,10 +162,11 @@ end end def wait_for_available_worker if !@worker_pool.worker_available? && @signal.start? - @worker_available_io.wait.read + @worker_available_io.wait + @worker_available_io.read end end def shutdown_worker_pool return unless @worker_pool