提交 4211866b 编写于 作者: A Aaron Patterson

adding active_connection? to the connection pool

上级 ec0cacc2
......@@ -151,6 +151,12 @@ def connection
@reserved_connections[current_connection_id] ||= checkout
end
# Check to see if there is an active connection in this connection
# pool.
def active_connection?
@reserved_connections.key? current_connection_id
end
# Signal that the thread is finished with the current connection.
# #release_connection releases the connection-thread association
# and returns the connection to the pool.
......
......@@ -18,6 +18,14 @@ def setup
end
end
def test_active_connection?
assert !@pool.active_connection?
assert @pool.connection
assert @pool.active_connection?
@pool.release_connection
assert !@pool.active_connection?
end
def test_pool_caches_columns
columns = @pool.columns['posts']
assert_equal columns, @pool.columns['posts']
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册