Navigation Menu

Skip to content

Commit

Permalink
Don't reduce results if the "replyTo" is not given, for now
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 17, 2015
1 parent 4a5e7ff commit ada4b94
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions lib/droonga/planner.rb
Expand Up @@ -35,7 +35,23 @@ def plan(message, params={})
options = {
:record => params[:record],
}
if @collector_class

#TODO: We don't have to reduce results of the message when
# the message doesn't have "replyTo" information, because:
#
# * Currently the "super step" mecahnism is not
# implemented yet.
# * So, reduced results won't be forwarded to other
# handlers directly. Results will be forwarded to
# the sender as the "response".
# * So, if "replyTo" information is not given, the
# reduced result will have no receiver.
#
# However, in the future after the "super step" mechanism
# is introduced, reduced results can be required even if
# the request message have no "replyTo" information.
# Then we must update this logic.
if @collector_class and message["replyTo"]
reduce_key = "result"
options[:reduce] = {
reduce_key => @collector_class.operator,
Expand Down Expand Up @@ -70,7 +86,7 @@ def scatter(message, options={})
scatter_options[:replica] = "random"
end
planner.scatter(scatter_options)
planner.reduce(options[:reduce])
planner.reduce(options[:reduce]) if options[:reduce]
planner.plan
end

Expand All @@ -86,7 +102,7 @@ def broadcast(message, options={})
broadcast_options[:replica] = "random"
end
planner.broadcast(broadcast_options)
planner.reduce(options[:reduce])
planner.reduce(options[:reduce]) if options[:reduce]
planner.plan
end
end
Expand Down

0 comments on commit ada4b94

Please sign in to comment.