Navigation Menu

Skip to content

Commit

Permalink
Don't store Loop by Dumper itself.
Browse files Browse the repository at this point in the history
It is just for the client.
  • Loading branch information
piroor committed Apr 10, 2015
1 parent 104104c commit c9024ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lib/drndump/command.rb
Expand Up @@ -105,12 +105,12 @@ def create_option_parser
end

def dump
@dumper = Dumper.new(@loop,
:host => @host,
@dumper = Dumper.new(:host => @host,
:port => @port,
:tag => @tag,
:receiver_host => @receiver_host,
:receiver_port => @receiver_port)
@dumper.run(:loop => @loop)
@loop.run
@dumper.error_message
end
Expand Down
13 changes: 4 additions & 9 deletions lib/drndump/dumper.rb
Expand Up @@ -26,23 +26,18 @@ module Drndump
class Dumper
attr_reader :error_message

def initialize(loop, params)
@loop = loop

def initialize(params)
@host = params[:host] || "localhost"
@port = params[:port] || 10031
@tag = params[:tag] || "droonga"
@dataset = params[:dataset] || "Default"

@receiver_host = params[:receiver_host] || Socket.gethostname
@receiver_port = params[:receiver_port] || 0

prepare
end

private
def prepare
client = Droonga::Client.new(client_options)
def run(loop)
client = Droonga::Client.new(client_options.merge(:loop => loop))

@error_message = nil
n_dumpers = 0
Expand Down Expand Up @@ -85,6 +80,7 @@ def prepare
end
end

private
def client_options
{
:host => @host,
Expand All @@ -94,7 +90,6 @@ def client_options
:receiver_host => @receiver_host,
:receiver_port => @receiver_port,
:backend => :coolio,
:loop => @loop,
}
end

Expand Down

0 comments on commit c9024ea

Please sign in to comment.