YUKI Hiroshi
null+****@clear*****
Fri Apr 10 12:14:38 JST 2015
YUKI Hiroshi 2015-04-10 12:14:38 +0900 (Fri, 10 Apr 2015) New Revision: 104104cfa40edbe2940c2bb3bb4624a93b41d3af https://github.com/droonga/drndump/commit/104104cfa40edbe2940c2bb3bb4624a93b41d3af Message: Don't execute Loop#run from Dumper. It's controlled by the command line tool itself. Modified files: lib/drndump/command.rb lib/drndump/dumper.rb Modified: lib/drndump/command.rb (+2 -1) =================================================================== --- lib/drndump/command.rb 2015-04-10 12:10:54 +0900 (91346b8) +++ lib/drndump/command.rb 2015-04-10 12:14:38 +0900 (bf8382c) @@ -111,7 +111,8 @@ module Drndump :tag => @tag, :receiver_host => @receiver_host, :receiver_port => @receiver_port) - @dumper.run + @loop.run + @dumper.error_message end end end Modified: lib/drndump/dumper.rb (+9 -8) =================================================================== --- lib/drndump/dumper.rb 2015-04-10 12:10:54 +0900 (44456f5) +++ lib/drndump/dumper.rb 2015-04-10 12:14:38 +0900 (432adec) @@ -24,6 +24,8 @@ require "drndump/version" module Drndump class Dumper + attr_reader :error_message + def initialize(loop, params) @loop = loop @@ -34,12 +36,15 @@ module Drndump @receiver_host = params[:receiver_host] || Socket.gethostname @receiver_port = params[:receiver_port] || 0 + + prepare end - def run + private + def prepare client = Droonga::Client.new(client_options) - error_message = nil + @error_message = nil n_dumpers = 0 dump_message = { @@ -50,14 +55,14 @@ module Drndump case message when Droonga::Client::Error client.close - error_message = message.to_s + @error_message = message.to_s else case message["type"] when "dump.result", "dump.error" if message["statusCode"] != 200 client.close error = message["body"] - error_message = "#{error['name']}: #{error['message']}" + @error_message = "#{error['name']}: #{error['message']}" end when "dump.table" table_create_message = convert_to_table_create_message(message) @@ -78,12 +83,8 @@ module Drndump end end end - @loop.run - - error_message end - private def client_options { :host => @host, -------------- next part -------------- HTML����������������������������... 다운로드