Navigation Menu

Skip to content

Commit

Permalink
Calculate routes for "scatter" correctly for no record given cases
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 15, 2015
1 parent 8a6e650 commit ef5c7e4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/droonga/catalog/slices_volume.rb
Expand Up @@ -73,19 +73,19 @@ def all_nodes

def compute_routes(message, active_nodes)
routes = []
slices = []
case message["type"]
when "broadcast"
slices = select_slices
slices.each do |slice|
routes.concat(slice.compute_routes(message, active_nodes))
end
when "scatter"
record = message["record"]
if record
slice = choose_slice(record)
slices = [choose_slice(record)]
else
slice = select_slices.sample
slices = select_slices
end
end
slices.each do |slice|
routes.concat(slice.compute_routes(message, active_nodes))
end
routes
Expand Down

0 comments on commit ef5c7e4

Please sign in to comment.