Skip to content

Commit

Permalink
relogin on reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
guilleiguaran committed Jun 17, 2010
1 parent cfbfc7b commit 91e9d6b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/cassandra/cassandra.rb
Expand Up @@ -95,7 +95,7 @@ def login!(username, password)
@auth_request.credentials = {'username' => username, 'password' => password}
client.login(@keyspace, @auth_request)
end

def inspect
"#<Cassandra:#{object_id}, @keyspace=#{keyspace.inspect}, @schema={#{
schema(false).map {|name, hash| ":#{name} => #{hash['type'].inspect}"}.join(', ')
Expand Down Expand Up @@ -298,10 +298,10 @@ def client
def reconnect!
@servers = all_nodes
@client = new_client
@client.login(@keyspace, @auth_request) if @auth_request
check_keyspace
@client.login(@keyspace, @auth_request) if @auth_request
end

def check_keyspace
unless (keyspaces = client.get_string_list_property("keyspaces")).include?(@keyspace)
raise AccessError, "Keyspace #{@keyspace.inspect} not found. Available: #{keyspaces.inspect}"
Expand Down

0 comments on commit 91e9d6b

Please sign in to comment.