Skip to content

Commit

Permalink
Increase the default connect_timeout to 5 seconds to mitigate errors …
Browse files Browse the repository at this point in the history
…on rapid schema changes
  • Loading branch information
Kelley Reynolds committed Sep 25, 2012
1 parent 371de10 commit 48e1884
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/cassandra-cql/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def initialize(servers, options={}, thrift_client_options={})
}.merge(options)

@thrift_client_options = {
:exception_class_overrides => CassandraCQL::Thrift::InvalidRequestException
:exception_class_overrides => CassandraCQL::Thrift::InvalidRequestException,
:connect_timeout => 5
}.merge(thrift_client_options)

@keyspace = @options[:keyspace]
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def yaml_fixture(file)
end

def setup_cassandra_connection
connection = CassandraCQL::Database.new(["127.0.0.1:9160"], {}, :retries => 5, :timeout => 1, :connect_timeout => 5)
connection = CassandraCQL::Database.new(["127.0.0.1:9160"], {}, :retries => 5, :timeout => 1)
if !connection.keyspaces.map(&:name).include?("CassandraCQLTestKeyspace")
connection.execute("CREATE KEYSPACE CassandraCQLTestKeyspace WITH strategy_class='org.apache.cassandra.locator.SimpleStrategy' AND strategy_options:replication_factor=1")
end
Expand Down

0 comments on commit 48e1884

Please sign in to comment.