diff options
author | Arthur Neves <arthurnn@gmail.com> | 2016-05-04 17:13:06 -0500 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2016-05-05 15:29:11 -0500 |
commit | 7d9d076e736a554e865d1735b5bd2dd69d69209b (patch) | |
tree | 815569cee0d10d5cd03d2bb878c13b33a769ecdd /activerecord/lib | |
parent | 40a8d2f3b530b61f032d7a9e0b85b392c54b573e (diff) | |
download | rails-7d9d076e736a554e865d1735b5bd2dd69d69209b.tar.gz rails-7d9d076e736a554e865d1735b5bd2dd69d69209b.tar.bz2 rails-7d9d076e736a554e865d1735b5bd2dd69d69209b.zip |
inline retrive_conn_pool method
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index 67a2ac3050..3968b59b8f 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -905,17 +905,7 @@ module ActiveRecord # take place, but that's ok since the nil case is not the common one that we wish # to optimise for. def retrieve_connection_pool(spec_id) - pool_for(spec_id) - end - - private - - def owner_to_pool - @owner_to_pool[Process.pid] - end - - def pool_for(spec_id) - owner_to_pool.fetch(spec_id) { + owner_to_pool.fetch(spec_id) do if ancestor_pool = pool_from_any_process_for(spec_id) # A connection was established in an ancestor process that must have # subsequently forked. We can't reuse the connection, but we can copy @@ -926,7 +916,13 @@ module ActiveRecord else owner_to_pool[spec_id] = nil end - } + end + end + + private + + def owner_to_pool + @owner_to_pool[Process.pid] end def pool_from_any_process_for(spec_id) |