Module: FiberedMysql2::FiberedDatabaseConnectionPool::Adapter_5_2

Defined in:
lib/fibered_mysql2/fibered_database_connection_pool.rb

Instance Method Summary collapse

Instance Method Details

#cached_connectionsObject



143
144
145
# File 'lib/fibered_mysql2/fibered_database_connection_pool.rb', line 143

def cached_connections
  @thread_cached_conns
end

#checkout(checkout_timeout = @checkout_timeout) ⇒ Object



151
152
153
154
155
156
157
158
# File 'lib/fibered_mysql2/fibered_database_connection_pool.rb', line 151

def checkout(checkout_timeout = @checkout_timeout)
  begin
    reap_connections
  rescue => ex
    ActiveRecord::Base.logger.error("Exception occurred while executing reap_connections: #{ex}")
  end
  super
end

#current_connection_idObject



147
148
149
# File 'lib/fibered_mysql2/fibered_database_connection_pool.rb', line 147

def current_connection_id
  connection_cache_key(current_thread)
end

#release_connection(owner_thread = Fiber.current) ⇒ Object



160
161
162
163
164
# File 'lib/fibered_mysql2/fibered_database_connection_pool.rb', line 160

def release_connection(owner_thread = Fiber.current)
  if (conn = @thread_cached_conns.delete(connection_cache_key(owner_thread)))
    checkin(conn)
  end
end