Navigation Menu

Skip to content

Commit

Permalink
Dispose client to get table names from destination node
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 23, 2015
1 parent a76ab8d commit 6431d27
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/droonga/data_absorber_client.rb
Expand Up @@ -158,19 +158,18 @@ def destination_client_options
}.merge(@client_options)
end

def create_destination_client(options={})
Droonga::Client.new(destination_client_options.merge(options))
end

def table_names_in_destination_node
@table_names_in_destination_node ||= get_table_names_in_destination_node
end

def get_table_names_in_destination_node
client = create_destination_client(:backend => :thread,
:loop => nil)
response = client.request("dataset" => @source_dataset,
"type" => "table_list")
response = nil
client_options = destination_client_options.merge(:backend => :thread,
:loop => nil)
Droonga::Client.open(client_options) do |client|
response = client.request("dataset" => @source_dataset,
"type" => "table_list")
end

unless response
raise EmptyResponse.new("table_list returns nil response")
Expand Down

0 comments on commit 6431d27

Please sign in to comment.