Skip to content

Commit

Permalink
Don't wait responses from suspended nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Dec 11, 2014
1 parent 690c82d commit a1d4fa8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 8 additions & 3 deletions lib/droonga/dispatcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,12 @@ def dispatch_steps(steps)
steps.each do |step|
dataset = @catalog.dataset(step["dataset"])
if dataset
routes = dataset.compute_routes(step, @engine_state.active_nodes)
if write_step?(step)
target_nodes = @engine_state.live_nodes
else
target_nodes = @engine_state.active_nodes
end
routes = dataset.compute_routes(step, target_nodes)
step["routes"] = routes
else
step["routes"] ||= [id]
Expand Down Expand Up @@ -345,8 +350,8 @@ def resolve_descendants
(step["outputs"] || []).each do |output|
descendants[output] = []
@descendants[output].each do |index|
live_routes = @engine_state.remove_dead_routes(step["routes"])
@steps[index]["n_of_expects"] += live_routes.size
active_routes = @engine_state.remove_inactive_routes(step["routes"])
@steps[index]["n_of_expects"] += active_routes.size
descendants[output].concat(@steps[index]["routes"])
end
end
Expand Down
5 changes: 3 additions & 2 deletions lib/droonga/engine_state.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ def live_nodes_list=(new_nodes_list)
@live_nodes_list
end

def remove_dead_routes(routes)
def remove_inactive_routes(routes)
routes.reject do |route|
dead_nodes.include?(farm_path(route))
node = farm_path(route)
dead_nodes.include?(node) or suspended_nodes.include?(node)
end
end

Expand Down

0 comments on commit a1d4fa8

Please sign in to comment.