提交 e060cf01 编写于 作者: A Aaron Patterson

deal with removing connections associated with the current thread

上级 17ff88c4
......@@ -222,6 +222,13 @@ def checkin(conn)
def remove(conn)
synchronize do
@connections.delete conn
# FIXME: we might want to store the key on the connection so that removing
# from the reserved hash will be a little easier.
thread_id = @reserved_connections.keys.find { |k|
@reserved_connections[k] == conn
}
@reserved_connections.delete thread_id if thread_id
end
end
......
......@@ -37,6 +37,14 @@ def test_remove_connection
conn.close
end
def test_remove_connection_for_thread
conn = @pool.connection
@pool.remove conn
assert_not_equal(conn, @pool.connection)
ensure
conn.close
end
def test_active_connection?
assert !@pool.active_connection?
assert @pool.connection
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册