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



209
210
211
# File 'lib/fibered_mysql2/fibered_database_connection_pool.rb', line 209

def cached_connections
  @thread_cached_conns
end

#checkout(checkout_timeout = @checkout_timeout) ⇒ Object



217
218
219
220
221
222
223
224
# File 'lib/fibered_mysql2/fibered_database_connection_pool.rb', line 217

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



213
214
215
# File 'lib/fibered_mysql2/fibered_database_connection_pool.rb', line 213

def current_connection_id
  connection_cache_key(current_thread)
end

#release_connection(owner_thread = Fiber.current) ⇒ Object



226
227
228
229
230
# File 'lib/fibered_mysql2/fibered_database_connection_pool.rb', line 226

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