Skip to content

Commit

Permalink
Remove Proxy::dispatch_internal.
Browse files Browse the repository at this point in the history
  • Loading branch information
daijiro committed Aug 15, 2013
1 parent cfd80d4 commit 096afe4
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions lib/droonga/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,28 @@ def handle_incoming_message(message)
end

def handle_internal_message(message)
dispatch_internal(message)
end

def dispatch(destination, message)
if local?(destination)
dispatch_internal(message)
else
post(farm_path(destination), message)
end
end

def dispatch_internal(message)
id = message["id"]
collector = @collectors[id]
unless collector
components = message["components"]
if components
planner = Planner.new(self, components)
collector = planner.get_collector(id)
else
#todo: take cases receiving result before its query into account
end
end
collector.handle(message["input"], message["value"])
end

def dispatch(destination, message)
if local?(destination)
handle_internal_message(message)
else
post(farm_path(destination), message)
end
end

def post(route, message)
@worker.post(message, "to"=> route, "type"=>"proxy")
end
Expand Down

0 comments on commit 096afe4

Please sign in to comment.