lib/rocket_job/worker_pool.rb in rocketjob-4.3.0.beta2 vs lib/rocket_job/worker_pool.rb in rocketjob-5.0.0.beta
- old
+ new
@@ -3,15 +3,14 @@
module RocketJob
class WorkerPool
include SemanticLogger::Loggable
- attr_reader :server_name, :filter, :workers
+ attr_reader :server_name, :workers
- def initialize(server_name, filter)
+ def initialize(server_name)
@server_name = server_name
- @filter = filter
@workers = Concurrent::Array.new
@worker_id = 0
end
# Find a worker in the list by its id
@@ -32,11 +31,11 @@
logger.info("#{'Stagger ' if stagger_start}Starting #{count} workers")
add_one
count -= 1
- delay = Config.instance.max_poll_seconds.to_f / max_workers
+ delay = Config.max_poll_seconds.to_f / max_workers
count.times.each do
sleep(delay) if stagger_start
return -1 if Supervisor.shutdown?
add_one
@@ -88,10 +87,10 @@
end
private
def add_one
- workers << Worker.new(id: next_worker_id, server_name: server_name, filter: filter)
+ workers << Worker.new(id: next_worker_id, server_name: server_name)
rescue StandardError => exc
logger.fatal('Cannot start worker', exc)
end
def next_worker_id