Navigation Menu

Skip to content

Commit

Permalink
Split operation to output fluent message actually from "forward"
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jan 6, 2015
1 parent 7437027 commit 2cabfa2
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions lib/droonga/engine_node.rb
Expand Up @@ -52,20 +52,7 @@ def shutdown
end

def forward(message, destination)
command = destination["type"]
receiver = destination["to"]
arguments = destination["arguments"]

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

def live?
Expand Down Expand Up @@ -129,6 +116,23 @@ def on_change
end

private
def output(message, destination)
command = destination["type"]
receiver = destination["to"]
arguments = destination["arguments"]

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

def log_tag
"[#{Process.ppid}] engine-node"
end
Expand Down

0 comments on commit 2cabfa2

Please sign in to comment.