aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-05-18 20:10:43 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-05-18 20:10:43 -0300
commit303dca482e2b7041e920733fe7f791a10bdbb9fc (patch)
tree127c9ef4f3292034fec97ad4345fd831f298abd5 /activerecord/lib/active_record
parentd4cfd543084f076af86e1716a7a5ef7dc30a7f17 (diff)
parent19bc570832e01c47f42ac2096637df59613c0efa (diff)
downloadrails-303dca482e2b7041e920733fe7f791a10bdbb9fc.tar.gz
rails-303dca482e2b7041e920733fe7f791a10bdbb9fc.tar.bz2
rails-303dca482e2b7041e920733fe7f791a10bdbb9fc.zip
Merge pull request #20175 from eugeneius/copy_schema_cache_after_fork
Add schema cache to new connection pool after fork
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb4
1 files changed, 3 insertions, 1 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 5bfb4d779c..6535121075 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
@@ -933,7 +933,9 @@ module ActiveRecord
# A connection was established in an ancestor process that must have
# subsequently forked. We can't reuse the connection, but we can copy
# the specification and establish a new connection with it.
- establish_connection owner, ancestor_pool.spec
+ establish_connection(owner, ancestor_pool.spec).tap do |pool|
+ pool.schema_cache = ancestor_pool.schema_cache if ancestor_pool.schema_cache
+ end
else
owner_to_pool[owner.name] = nil
end