lib/larva/worker_pool.rb in larva-0.4.1 vs lib/larva/worker_pool.rb in larva-0.5.0
- old
+ new
@@ -1,15 +1,14 @@
module Larva
class WorkerPool
- def self.start(processors, queue_suffix)
- new(processors, queue_suffix).start
+ def self.start(processors)
+ new(processors).start
end
- attr_reader :processors, :queue_suffix, :workers
- def initialize(processors, queue_suffix)
+ attr_reader :processors, :workers
+ def initialize(processors)
@processors = processors
- @queue_suffix = queue_suffix
end
def start
start_workers
keep_workers_alive if workers.count > 0
@@ -23,16 +22,16 @@
end
logger.info "Threads Started."
end
def start_worker(topic, processor)
- Larva::Listener.listen(topic, processor, queue_suffix)
+ Larva::Listener.listen(topic, processor)
rescue => e
logger.error "Unexpected listener termination: #{e} #{e.backtrace}"
end
def keep_workers_alive
- sleep(1) while workers.all? { |t| t.alive? }
+ sleep(5) while workers.all? { |t| t.alive? }
logger.error "Some threads have died"
end
def logger
Propono.config.logger