Navigation Menu

Skip to content

Commit

Permalink
Send message to dead nodes if it is "write" step
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jun 26, 2014
1 parent 03be582 commit 9864287
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/droonga/dispatcher.rb
Expand Up @@ -174,7 +174,9 @@ def dispatch_steps(steps)
steps.each do |step|
dataset = @catalog.dataset(step["dataset"])
if dataset
routes = dataset.get_routes(step, @engine_state.live_nodes)
target_nodes = nil
target_nodes = @engine_state.live_nodes unless write_step?(step)
routes = dataset.get_routes(step, target_nodes)
step["routes"] = routes
else
step["routes"] ||= [id]
Expand Down Expand Up @@ -211,6 +213,16 @@ def local?(route)
@engine_state.local_route?(route)
end

def write_step?(step)
step_runner = @step_runners[step["dataset"]]
return false unless step_runner

step_definition = step_runner.find(step["command"])
return false unless step_definition

step_definition.write?
end

private
def farm_path(route)
@engine_state.farm_path(route)
Expand Down

0 comments on commit 9864287

Please sign in to comment.