Navigation Menu

Skip to content

Commit

Permalink
Remove needless custom implementation to parse node name
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 30, 2015
1 parent 5d496e7 commit 2597d53
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions lib/droonga/engine_node.rb
Expand Up @@ -181,17 +181,6 @@ def resume
end

private
def parse_node_name(name)
unless name =~ /\A(.*):(\d+)\/([^.]+)\z/
raise "name format: hostname:port/tag"
end
{
:host => $1,
:port => $2,
:tag => $3,
}
end

def have_unprocessed_messages?
@state and @state["have_unprocessed_messages"]
end
Expand Down Expand Up @@ -249,14 +238,14 @@ def output(message, destination)
command = destination["type"]
receiver = destination["to"]
arguments = destination["arguments"]
parsed_receiver = parse_node_name(receiver)
parsed_receiver = NodeName.parse(receiver)

override_message = {
"type" => command,
}
override_message["arguments"] = arguments if arguments
message = message.merge(override_message)
output_tag = "#{parsed_receiver[:tag]}.message"
output_tag = "#{parsed_receiver.tag}.message"
log_info = "<#{receiver}>:<#{output_tag}>"
logger.trace("forward: start: #{log_info}")
sender.send(output_tag, message)
Expand Down

0 comments on commit 2597d53

Please sign in to comment.