inline retrive_conn_pool method

上级 40a8d2f3
...@@ -905,17 +905,7 @@ def remove_connection(spec_id) ...@@ -905,17 +905,7 @@ def remove_connection(spec_id)
# take place, but that's ok since the nil case is not the common one that we wish # take place, but that's ok since the nil case is not the common one that we wish
# to optimise for. # to optimise for.
def retrieve_connection_pool(spec_id) def retrieve_connection_pool(spec_id)
pool_for(spec_id) owner_to_pool.fetch(spec_id) do
end
private
def owner_to_pool
@owner_to_pool[Process.pid]
end
def pool_for(spec_id)
owner_to_pool.fetch(spec_id) {
if ancestor_pool = pool_from_any_process_for(spec_id) if ancestor_pool = pool_from_any_process_for(spec_id)
# A connection was established in an ancestor process that must have # A connection was established in an ancestor process that must have
# subsequently forked. We can't reuse the connection, but we can copy # subsequently forked. We can't reuse the connection, but we can copy
...@@ -926,7 +916,13 @@ def pool_for(spec_id) ...@@ -926,7 +916,13 @@ def pool_for(spec_id)
else else
owner_to_pool[spec_id] = nil owner_to_pool[spec_id] = nil
end end
} end
end
private
def owner_to_pool
@owner_to_pool[Process.pid]
end end
def pool_from_any_process_for(spec_id) def pool_from_any_process_for(spec_id)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册