Navigation Menu

Skip to content

Commit

Permalink
Remove needless helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jun 27, 2014
1 parent 709d8cc commit b430e10
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions lib/droonga/dispatcher.rb
Expand Up @@ -172,8 +172,10 @@ def dispatch_steps(steps)
id = @engine_state.generate_id

one_way_steps = []
one_way_destinations = []
have_dead_nodes = !@engine_state.dead_nodes.empty?

destinations = []
steps.each do |step|
dataset = @catalog.dataset(step["dataset"])
if dataset
Expand All @@ -183,39 +185,31 @@ def dispatch_steps(steps)
one_way_step = Marshal.load(Marshal.dump(step))
one_way_step["routes"] = routes
one_way_steps << one_way_step
one_way_destinations += routes.collect(&:farm_path)
end
end
routes = dataset.get_routes(step, @engine_state.live_nodes)
step["routes"] = routes
else
step["routes"] ||= [id]
end
destinations += step["routes"].collect(&:farm_path)
end

dispatch_message = { "id" => id, "steps" => steps }
get_destinations(steps).each do |destination|
destinations.uniq.each do |destination|
dispatch(dispatch_message, destination)
end

unless one_way_steps.empty?
dispatch_message = { "id" => @engine_state.generate_id,
"steps" => one_way_steps }
get_destinations(one_way_steps).each do |destination|
one_way_destinations.uniq.each do |destination|
dispatch(dispatch_message, destination)
end
end
end

def get_destinations(steps)
destinations = {}
steps.each do |step|
step["routes"].each do |route|
destinations[farm_path(route)] = true
end
end
destinations.keys
end

def process_local_message(local_message)
task = local_message["task"]
slice_name = task["route"]
Expand Down

0 comments on commit b430e10

Please sign in to comment.