class Believer::Connection::Pool

Public Instance Methods

connection(environment) click to toggle source

Retrieve a connection from the pool @param environment [Believer::Environment::BaseEnv] the environment with the connection configuration

# File lib/believer/connection.rb, line 27
def connection(environment)
  unless @connection_pool
    pool_config = environment.connection_pool_configuration
    if pool_config.nil?
      pool_config = {
          :size => 1,
          :timeout => 10
      }
    end
    @connection_pool ||= ::ConnectionPool.new(pool_config) do
      environment.create_connection(:connect_to_keyspace => true)
    end
  end
  @connection_pool
end