diff options
author | Richard Schneeman <richard.schneeman@gmail.com> | 2016-09-13 12:39:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-13 12:39:06 -0500 |
commit | d4bbac8446be51a49382f04caba2e2c5582289ed (patch) | |
tree | c127fee761401694cc4cfe8c09011374de8a12ee /railties/lib/rails | |
parent | c49751be1f528a258572c7ecce8e066807352528 (diff) | |
parent | c1ee40ea3848e9489c02767a62b6ceba511b997c (diff) | |
download | rails-d4bbac8446be51a49382f04caba2e2c5582289ed.tar.gz rails-d4bbac8446be51a49382f04caba2e2c5582289ed.tar.bz2 rails-d4bbac8446be51a49382f04caba2e2c5582289ed.zip |
Merge pull request #26314 from frodsan/puma-ar-disconnect
Disconnects all connections in the pool before forking.
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/puma.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/puma.rb b/railties/lib/rails/generators/rails/app/templates/config/puma.rb index 121ad7080e..a44bfbabec 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/puma.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/puma.rb @@ -42,6 +42,14 @@ environment ENV.fetch("RAILS_ENV") { "development" } # on_worker_boot do # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) # end +# +# If you are preloading your application and using ActiveRecord, it's +# recommended that you close any connections to the database before workers +# are forked to prevent connection leakage. +# +# before_fork do +# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord) +# end # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart |